public void Can_find_animal_by_userId_and_AnimalName() { //arrange const string animalName = "Tom"; const string userId = "*****@*****.**"; const AnimalTypes type = AnimalTypes.Cat; var repository = new InMemoryAnimalRepository(AnimalDataUtilities.AnimalData(userId)); var service = new VirtualPet.Services.AnimalFindService(repository); //act var returnedAnimal = service.GetByIdentifier(new AnimalIdentifier(userId, animalName)); //assert returnedAnimal.Name.Should().Be(animalName); returnedAnimal.Owner.Should().Be(userId); returnedAnimal.Type.Should().Be(type); }
public void Repository_is_called_when_finding_a_Animal_by_AnimalIdentifier() { //arrange const string animalName = "ted"; const string userId = "*****@*****.**"; var repository = Substitute.For <IAnimalRepository>(); var service = new VirtualPet.Services.AnimalFindService(repository); //act var identifier = new AnimalIdentifier(userId, animalName); service.GetByIdentifier(identifier); //assert repository.ReceivedWithAnyArgs().GetByUserIdandAnimalName(Arg.Any <string>(), Arg.Any <string>()); }