コード例 #1
0
        public async Task TestGetStockItemsAsync()
        {   // Arrange
            var dbContext  = DbContextMocker.GetWideWorldImportersDbContext(nameof(TestGetStockItemAsync));
            var controller = new WarehouseController(null, dbContext);

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

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

            dbContext.Dispose();

            // Assert
            Assert.False(value.DidError);
        }
        public async Task TestGetStockItemsAsync()
        {
            // Arrange
            var repository = RepositoryMocker.GetWarehouseRepository(nameof(TestGetStockItemsAsync));
            var controller = new WarehouseController(null, repository);

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

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

            repository.Dispose();

            // Assert
            Assert.False(value.DidError);
        }