1

「1」をワイルドカード (0 より大きい任意の数) として置き換えることができるものはありますか?

[TestMethod]
public void GameManagersEventsIndexReturnedWhenUserHasNoLocations()
{
    // Arrange
    List<CustomerLocation> locations = new List<CustomerLocation>();
    locations.Add(new CustomerLocation() { Active = true, Name = "Ted" });

    customerLocationDataProvider.Setup(x => x.GetAllForUserId(1)).Returns(locations);
    customerLocationDataProvider.Setup(x => x.GetAllForUserId(1).Count).Returns(0);
4

1 に答える 1

3

MOQを使用している場合は、次のことができます

x => x.GetAllForUserId(It.Is<int>(i => i > 0)) // condition that int value is > 0 or you can have any other conditions

また

x => x.GetAllForUserId(It.IsAny<int>()) //if you don't care about the value
于 2013-07-20T02:15:39.693 に答える