public async Task TestCanGetOnlyMalePeople() { PetFinder sut = CreateMockPetFinder(); var result = (await sut.GetPeopleAsync("mel", gender: Gender.Female)).ToList(); // confirm that the pet finder used the client injected. Assert.That(result, Has.Count.EqualTo(3)); }
public async Task TestGetNoIndeterminatePeople() { PetFinder sut = CreateMockPetFinder(); var result = (await sut.GetPeopleAsync("mel", gender: Gender.DeclinedToSay)).ToList(); // confirm that the pet finder used the client injected. Assert.That(result, Has.Count.EqualTo(0)); }
public async Task TestCanFilterPetsByOwnerGender() { PetFinder sut = CreateMockPetFinder(); var result = (await sut.GetPeopleAsync("mel")).ToList(); // confirm that the pet finder used the client injected. Assert.That(result, Has.Count.EqualTo(6)); }
public async Task TestPetFinderCollatesAllPets() { PetFinder sut = CreateMockPetFinder(); var result = (await sut.GetPetsAsync("mel")).ToList(); // confirm that the pet finder used the client injected. Assert.That(result, Has.Count.EqualTo(8)); }
public async Task TestCanGetByAgePeople() { PetFinder sut = CreateMockPetFinder(); var result = (await sut.GetPeopleAsync("mel", age: 18)).ToList(); // confirm that the pet finder used the client injected. result.Should().HaveCount(1); result.ElementAt(0).Name.Should().Be("Jennifer"); }
private PetFinder CreateMockPetFinder() { var mock = new Mock <IPetFinderRepositoryClient>(); mock.Setup(foo => foo.GetAsync(It.IsAny <string>())).Returns(Task.FromResult(GetMelbourneTestData())); var sut = new PetFinder(mock.Object); return(sut); }
public async Task TestCanRetrievePeopleByNameAsync() { PetFinder sut = CreateMockPetFinder(); var result = (await sut.GetPeopleAsync("mel", name: "Bob")).Single(); // confirm that the pet finder used the client injected. result.Should().NotBeNull(); result.Name.Should().Be("Bob"); result.Age.Should().Be(23); }