public void Can_find_users_Animal_by_userId() { //arrange const string expectedAnimalName = "freddy"; const AnimalTypes expectedAnimalType = AnimalTypes.Cat; const string userId = "*****@*****.**"; var listOfAnimals = new Animals { new Cat { Name = expectedAnimalName, Type = AnimalTypes.Cat, Owner = userId } }; //act var repository = new VirtualPet.Repositories.InMemoryAnimalRepository(listOfAnimals); var animal = repository.GetByUserId(userId).First(); //assert animal.Name.Should().Be(expectedAnimalName); animal.Type.Should().Be(expectedAnimalType); }
public void Can_find_users_animals_by_userId() { //arrange var userId = "*****@*****.**"; //act var count = new VirtualPet.Repositories.InMemoryAnimalRepository(new Animals { new Cat { Owner = "*****@*****.**" }, new Cat { Owner = "*****@*****.**" }, new Cat { Owner = userId }, new Cat { Owner = userId }, new Cat { Owner = userId }, new Cat { Owner = userId } }).GetByUserId(userId).Count(); //assert count.Should().Be(4); }