コード例 #1
0
        public async Task TestPutProductPriceAsync()
        {
            // Arrange
            var dbContext  = DbContextMocker.GetStoreDbContext(nameof(TestPutProductPriceAsync));
            var service    = ServiceMocker.GetWarehouseService(dbContext);
            var controller = new WarehouseController(service, null);
            var id         = 1000;
            var request    = new UpdateProductPriceRequest
            {
                Price = 2.25m
            };

            controller.MockControllerContext();

            // Act
            var response = await controller.PutProductPriceAsync(id, request) as ObjectResult;

            var value = response.Value as IResponse;

            service.Dispose();

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