Exemple #1
0
        public async Task GetProductsTestAsync()
        {
            // Arrange
            var productionBusinessObject = BusinessObjectMocker.GetProductionBusinessObject();

            using (var controller = new ProductionController(null, productionBusinessObject))
            {
                // Act
                var response = await controller.GetProductsAsync() as ObjectResult;

                // Assert
                var value = response.Value as IListModelResponse <Product>;

                Assert.False(value.DidError);
            }
        }
        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);
        }
Exemple #3
0
        public async Task GetProductsTestAsync()
        {
            // Arrange
            var logger            = LoggerMocker.GetLogger <ProductionController>();
            var productionService = ServiceMocker.GetProductionService();

            using (var controller = new ProductionController(logger, productionService))
            {
                // Act
                var response = await controller.GetProductsAsync() as ObjectResult;

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

                // Assert
                Assert.False(value.DidError);
            }
        }
Exemple #4
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);
        }