public static IEnumerable <ISorter> WithSorters(Contracts.Models.SorterType sorterType = Contracts.Models.SorterType.All) { var sorters = Bootup().GetAllInstances <ISorter>(); var sorter = sorters.SingleOrDefault(q => q.GetType().GetAttributeType() == sorterType); return(sorterType == Contracts.Models.SorterType.All ? sorters : new List <ISorter> { sorter }); }
public void ThenTheSortersShouldSucceed(Contracts.Models.SorterType sorterType, string[] text, string[] expectedResult) { var result = WithBootstrapper .WithSorterFactoryInstance() .WithTextContent(text) .WithSorter(sorterType); Assert.Equal(result.Select(q => q.Key), expectedResult); }
public void ThenThereShouldBeAtLeastOneSorter(Contracts.Models.SorterType sorterType) { try { WithBootstrapper .WithSorterFactoryInstance() .WithTextContent(null) .WithSorter(sorterType); } catch (Exception exception) { Assert.IsType <NullReferenceException>(exception); } }