public void ShouldOrderByLevel(string orderDirection) { var fakeContext = new FakeContext("OrderByLevel"); fakeContext.FillWith <Error>(); using (var context = new CentralErrosContext(fakeContext.FakeOptions)) { var service = new ErrorRepository(context); var actual = service.OrderByLevel(service.GetAll(), orderDirection).ToList(); var expected = new List <Error>(); if (orderDirection == "descending") { expected = fakeContext.GetFakeData <Error>().OrderByDescending(x => x.LevelId).ToList(); Assert.Equal(expected, actual, new ErrorIdComparer()); } else { expected = fakeContext.GetFakeData <Error>().OrderBy(x => x.LevelId).ToList(); Assert.Equal(expected, actual, new ErrorIdComparer()); } } }
/// <summary> /// Query for all Error Codes /// </summary> /// <returns>Collection of all Error Codes</returns> public IEnumerable <Error> GetAllNoteCodes() { var errors = ErrorRepository.GetAll() .ToList(); return(errors); }
public void ShouldGetAll() { var fakeContext = new FakeContext("GetAll"); fakeContext.FillWith <Error>(); using (var context = new CentralErrosContext(fakeContext.FakeOptions)) { var expected = fakeContext.GetFakeData <Error>(); var service = new ErrorRepository(context); var actual = service.GetAll(); Assert.Equal(expected, actual, new ErrorIdComparer()); } }