public void ExportWarehouse_EmptyDataBase_ThrowsException() { //Arrange mockWareRepo = new MockWarehouseRepository(true); var mockMapper = new Mock <AutoMapper.IMapper>(); var mapper = mockMapper.Object; var mockHopArrivalLogicLogger = new Mock <ILogger <WarehouseLogic> >(); ILogger <WarehouseLogic> warehouseLogicLogger = mockHopArrivalLogicLogger.Object; var mockCleaner = new Mock <DataAccess.Interfaces.IDbCleaner>(); var cleaner = mockCleaner.Object; Interfaces.IWarehouseLogic warehouseLogic = new WarehouseLogic(mockWareRepo, warehouseLogicLogger, mapper, cleaner); //Act //Assert Assert.ThrowsException <BlException>(() => warehouseLogic.ExportWarehouses()); }
public void ExportWarehouse_FilledDataBase_Success() { //Arrange mockWareRepo = new MockWarehouseRepository(); var mockMapper = new Mock <AutoMapper.IMapper>(); mockMapper.Setup(m => m.Map <Entities.Warehouse>(It.IsAny <DataAccess.Entities.Warehouse>())).Returns(validBLWarehouse); mockMapper.Setup(m => m.Map <IO.Swagger.Models.Warehouse>(It.IsAny <Entities.Warehouse>())).Returns(validRoot); var mapper = mockMapper.Object; var mockHopArrivalLogicLogger = new Mock <ILogger <WarehouseLogic> >(); ILogger <WarehouseLogic> warehouseLogicLogger = mockHopArrivalLogicLogger.Object; var mockCleaner = new Mock <DataAccess.Interfaces.IDbCleaner>(); var cleaner = mockCleaner.Object; Interfaces.IWarehouseLogic warehouseLogic = new WarehouseLogic(mockWareRepo, warehouseLogicLogger, mapper, cleaner); //Act IO.Swagger.Models.Warehouse rootWarehouse = warehouseLogic.ExportWarehouses(); //Assert Assert.IsNotNull(rootWarehouse); }