public void AddDogsInSameCategoryToDogsCollection_when_appending_dogs_in_same_category_then_there_are_no_duplicates_returned() { // arrange var dogSearchResultsListBuilder = new DogSearchResultsListBuilder(); var dogsMatchingByBreed = dogSearchResultsListBuilder.ListOfThreeDuplicateDogs(_categoryId, _breedIdDalmatian).Build().AsQueryable(); var dogCategoryService = new DogCategoryService(_configuration, _breedsRepository, _dogCategoryFilterStrategy); // act var results = dogCategoryService.AddDogsInSameCategoryToDogsCollection(dogsMatchingByBreed, _breedIdDalmatian); // assert Assert.That(results.Count(), Is.EqualTo(4)); }
public void AddDogsInSameCategoryToDogsCollection_place_matching_dogs_above_dogs_in_same_category() { // arrange var dogSearchResultsListBuilder = new DogSearchResultsListBuilder(); var dogsMatchingByBreed = dogSearchResultsListBuilder.ListOf3DalmatiansByCategory(_categoryId, _breedIdDalmatian).Build().AsQueryable(); var dogCategoryService = new DogCategoryService(_configuration, _breedsRepository, _dogCategoryFilterStrategy); // act var results = dogCategoryService.AddDogsInSameCategoryToDogsCollection(dogsMatchingByBreed, _breedIdDalmatian); // assert Assert.That(results.First().Breed.Id == _breedIdDalmatian); Assert.That(results.Last().Breed.Id == _breedIdBeagel); }
public void AddDogsInSameCategoryToDogsCollection_when_no_matching_dogs_then_return_dogs_in_category() { // arrange var dogSearchResultsListBuilder = new DogSearchResultsListBuilder(); var dogsMatchingByBreedEmptyList = new List<Dog>().AsQueryable(); var dogCategoryService = new DogCategoryService(_configuration, _breedsRepository, _dogCategoryFilterStrategy); // act var results = dogCategoryService.AddDogsInSameCategoryToDogsCollection(dogsMatchingByBreedEmptyList, _breedIdDalmatian); // assert Assert.That(results.Count(), Is.EqualTo(3)); }