示例#1
0
        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));
        }
示例#2
0
        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));
        }
示例#3
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));
        }
示例#4
0
        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");
        }
示例#5
0
        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);
        }