public async Task TestGetProductsAsync()
        {
            // Arrange
            var repository = RepositoryMocker.GetAdventureWorksRepository();
            var controller = new ProductionController(repository, null);

            // Act
            var response = await controller.GetProductsAsync() as ObjectResult;

            var value = response.Value as IListModelResponse <ProductViewModel>;

            controller.Dispose();

            // Assert
            Assert.False(value.DidError);
        }
Exemplo n.º 2
0
        public async Task TestGetProductsTestAsync()
        {
            // Arrange
            var logger            = LogHelper.GetLogger <ProductionController>();
            var productionService = ServiceMocker.GetProductionService(nameof(TestGetProductsTestAsync));
            var controller        = new ProductionController(logger, productionService);

            // Act
            var response = await controller.GetProductsAsync() as ObjectResult;

            var value = response.Value as IPagedResponse <Product>;

            controller.Dispose();

            // Assert
            Assert.False(value.DidError);
            Assert.True(value.Model.Count() > 0);
        }
Exemplo n.º 3
0
        public async Task TestGetInventoryByProductTestAsync()
        {
            // Arrange
            var logger            = LogHelper.GetLogger <ProductionController>();
            var productionService = ServiceMocker.GetProductionService(nameof(TestGetInventoryByProductTestAsync));
            var controller        = new ProductionController(logger, productionService);
            var productID         = 1;
            var warehouseID       = "W0001";

            // Act
            var response = await controller.GetProductInventoryAsync(productID, warehouseID) as ObjectResult;

            var value = response.Value as IListResponse <ProductInventory>;

            controller.Dispose();

            // Assert
            Assert.False(value.DidError);
            Assert.True(value.Model.Count() > 0);
        }