public void WhenModelStateIsValidEquals_method_should_work_as_expected()
        {
            ForTest.Scenarios(true, false)
            .TestEach(isValid =>
            {
                bool result = _controllerTester.Action <bool>(x => x.BoolResultActionThatChecksModelState)
                              .WhenModelStateIsValidEquals(isValid)
                              .Test(response => response.Should().Be(isValid));

                result.Should().Be(isValid);
            });
        }
Пример #2
0
 public void WhenModelStateIsValidEquals_method_should_work_as_expected()
 {
     ForTest.Scenarios(
         (Valid: true, ExpectedStatus: HttpStatusCode.OK),
         (Valid: false, ExpectedStatus: HttpStatusCode.BadRequest)
         )
     .TestEach(scenario =>
     {
         _controllerTester.Action(x => x.HttpResponseMessageActionThatChecksModelState)
         .WhenModelStateIsValidEquals(scenario.Valid)
         .ExpectingHttpStatusCode(scenario.ExpectedStatus)
         .Test();
     });
 }
        public void WhenModelStateIsValidEquals_method_should_work_as_expected()
        {
            _controllerTester.Action(x => x.HttpActionResultActionThatChecksModelState)
            .WhenModelStateIsValidEquals(true)
            .TestOkResult();

            _controllerTester.Action(x => x.HttpActionResultActionThatChecksModelState)
            .WhenModelStateIsValidEquals(false)
            .TestBadRequestResult();
        }