예제 #1
0
        public async Task TestCreateShouldReturnProductViewModel()
        {
            _mediator.Setup(m => m.Send(It.IsAny <GetProductByIdQuery>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new GetProductByIdQueryResponse()
            {
                Id              = 2,
                Name            = "Test",
                NoOfUnit        = 12,
                ReOrderLevel    = 1,
                UnitPrice       = 100,
                CreatedBy       = "TestUser",
                CreatedDateTime = DateTimeOffset.Now
            });

            var result = await _factory.Create(2);

            Assert.That(result.GetType(), Is.EqualTo(typeof(ProductViewModel)));
        }
 public async Task <IActionResult> Edit(int id)
 {
     return(View(await _factory.Create(id)));
 }