public void ExportWarehouse_ReadException() { Mock <IWarehouseRepository> mock = new Mock <IWarehouseRepository>(); mock.Setup(foo => foo.Read()).Throws(new WarehouseNotFoundExpection()); IWarehouseManagementLogic warehouseManagementLogic = new WarehouseManagementLogic(mapper, mock.Object, NullLogger <WarehouseManagementLogic> .Instance); Assert.Throws <BusinessLayerException>(() => warehouseManagementLogic.ExportWarehouse()); }
public void ExportWarehouse_IsOk() { string code = "123456789"; Mock <IWarehouseRepository> mock = new Mock <IWarehouseRepository>(); DA.Warehouse wh = new DA.Warehouse() { Code = code }; mock.Setup(foo => foo.Read()).Returns(wh); IWarehouseManagementLogic warehouseManagementLogic = new WarehouseManagementLogic(mapper, mock.Object, NullLogger <WarehouseManagementLogic> .Instance); Warehouse w = warehouseManagementLogic.ExportWarehouse(); Assert.NotNull(w); Assert.Equal(code, w.Code); }