public void DomainResult_With_Value_Converted_ToActionResult_Test <TValue>(IDomainResult <TValue> domainValue)
        {
            // WHEN convert a value to ActionResult
            var actionRes = domainValue.ToActionResult();
            // and to ActionResult<T>
            var actionResOfT = domainValue.ToActionResultOfT();

            // THEN the response type is correct
            var okResult = actionRes as OkObjectResult;

            Assert.NotNull(okResult);
            Assert.NotNull(actionResOfT);

            // and value remains there
            Assert.Equal(domainValue.Value, okResult !.Value);
            Assert.Equal(domainValue.Value, actionResOfT.Value);
        }
Exemplo n.º 2
0
        public void Failed_DomainResult(IDomainResult domainValue, int expectedCode, string expectedTitle, string expectedErrorMsg)
        {
            var actionRes = domainValue.ToActionResult();

            Then_ResponseType_Correct_And_ProblemDetails_StatusAndText_Correct(actionRes, expectedCode, expectedTitle, expectedErrorMsg);
        }