コード例 #1
0
        public ActionResult DeleteTest([PexAssumeUnderTest] PedidoController target, int?id)
        {
            ActionResult result = target.Delete(id);

            return(result);
            // TODO: agregar aserciones a método PedidoControllerTest.DeleteTest(PedidoController, Nullable`1<Int32>)
        }
コード例 #2
0
        public void Delete()
        {
            // Act
            var result   = controller.Delete(valor.Id);
            var okResult = result as OkObjectResult;

            // Assert
            Assert.Greater(valor.Id, 0, "Id é nullo");
            Assert.IsNotNull(okResult, ((Microsoft.AspNetCore.Mvc.ObjectResult)result).Value.ToString());
            Assert.AreEqual(200, okResult.StatusCode);
        }
コード例 #3
0
        public async Task Delete_Should_Return_Ok()
        {
            //Arrange
            var response = Task.Run(() => new DeletePedidoResponse());

            //Act
            response.Result.SetSucess(true);
            _mock.Setup(x => x.Delete(1)).Returns(response);
            var result = await _controller.Delete(1) as OkResult;

            //Assert
            result.Should().BeOfType <OkResult>("Tipo do resultado não é OkResult");
            result.StatusCode.Should().Be(200, $"Status Code {result.StatusCode}");
        }