public void Returns_Null_Object_If_Null_List() { var sortingProvider = new SortingProvider(); var result = sortingProvider.SortAndFilter(null, JoseRamos.Agl.Core.Models.Enums.Animal.Cat); Assert.IsNull(result); }
public void Check_That_Sorting_Returns_Only_Cats() { var sortingProvider = new SortingProvider(); var result = sortingProvider.SortAndFilter(ownerlist, JoseRamos.Agl.Core.Models.Enums.Animal.Cat); foreach (OwnerSortResult item in result) { Assert.AreEqual(item.AnimalType.ToString(), "Cat"); } }
public void Check_That_Sorting_Returns_Only_Dogs() { var sortingProvider = new SortingProvider(); var result = sortingProvider.SortAndFilter(ownerlist, JoseRamos.Agl.Core.Models.Enums.Animal.Dog); foreach (OwnerSortResult item in result) { foreach (var pet in item.PetNames) { //Wanda is the only fish in the test data Assert.AreNotEqual(pet, "Wanda"); } Assert.AreEqual(item.AnimalType.ToString(), "Dog"); } }
public void Sort_Method_Sorts_The_Data_Accordingly_To_The_Given_Order(string[] givenOrder, string[] expectedSortArray, bool forward) { // need some preprocessing here var timeSpanConverter = new TimeSpanConverter(); var csvFileDataProcessor = new CsvFileDataProcessor(timeSpanConverter, ','); var errors = new Dictionary <int, string>(); var processedSequence = csvFileDataProcessor.ProcessData(givenOrder, givenOrder.Length, false, errors); var config = new Mock <IConfiguration>(); config.SetupProperty(h => h.HasHeader, false); var converter = new TimeSpanConverter(); var sortingProvider = new SortingProvider(config.Object, converter); var resultingSort = sortingProvider.Sort(processedSequence, forward); var resultingSortArray = resultingSort.ToStringArray(); Assert.AreEqual(expectedSortArray, resultingSortArray); }