public void GetSingleUomId0ThrowsArgumentOutOfRangeException() { var connection = new SqliteConnection("DataSource=:memory:"); try { using (var context = GetPropertyContext(connection)) { var uomRepository = new UomReadRepository(context); Assert.ThrowsAsync <ArgumentOutOfRangeException> ( async() => await uomRepository.GetAsync(0) ); } } finally { connection.Close(); } }
public async Task GetSingleUomNotFound() { var connection = new SqliteConnection("DataSource=:memory:"); try { var testData = UomTestData.GetUomsArray(); new DbInitializer().Initialize(connection, GetPropertyContext, UomTestData.GetInitialData()); using (var context = GetPropertyContext(connection)) { var uomRepository = new UomReadRepository(context); var uom = await uomRepository.GetAsync(111111); Assert.Null(uom); } } finally { connection.Close(); } }
public async Task GetPageNotFound() { var connection = new SqliteConnection("DataSource=:memory:"); try { var testData = UomTestData.GetUomsArray(); new DbInitializer().Initialize(connection, GetPropertyContext, UomTestData.GetInitialData()); using (var context = GetPropertyContext(connection)) { var uomRepository = new UomReadRepository(context); var expectedPage = PageMaker.GetExpectedPage <Uom>(testData, "", 1000, 20); var actualPage = await uomRepository.GetAsync("", 1000, 20) as Page <Uom>; Assert.True(PageEqual.Check(expectedPage, actualPage, UomEqual.Check)); } } finally { connection.Close(); } }
public async Task GetUomCollectionTakeLessThan1() { var connection = new SqliteConnection("DataSource=:memory:"); try { var testData = UomTestData.GetUomsArray(); new DbInitializer().Initialize(connection, GetPropertyContext, UomTestData.GetInitialData()); using (var context = GetPropertyContext(connection)) { var uomRepository = new UomReadRepository(context); Assert.ThrowsAsync <ArgumentOutOfRangeException> ( async() => await uomRepository.GetAsync("", 0, 0) ); } } finally { connection.Close(); } }