public void Save() { try { var options = CreateNewContextOptions(); using (var db = new OrderContext(options)) { ProcessingTestHelper.PopulateDefaultOrderCtx(db); } using (var db = new OrderContext(options)) { var repository = new DeliveryZoneRepository(db); var item = ProcessingTestHelper.GenerateDeliveryZone(); Assert.DoesNotThrow(() => repository.Save(item)); Assert.DoesNotThrow(() => repository.Delete(item)); Assert.Greater(item.Id, 0); } } catch (Exception ex) { LogEventManager.Logger.Error(ex); throw; } }
public void Get(DbContextOptions <OrderContext> options, DeliveryZoneFilter filter, int expectedResult) { try { using (var db = new OrderContext(options)) { IEnumerable <DeliveryZone> result = new List <DeliveryZone>(); var repository = new DeliveryZoneRepository(db); Assert.DoesNotThrow(() => result = repository.Get(filter)); Assert.True(result != null && result.Count() == expectedResult); } } catch (Exception ex) { LogEventManager.Logger.Error(ex.Message, ex); throw; } }