Example #1
0
        public void WithGenericModelShouldNotThrowException()
        {
            var model = TestObjectFactory.GetValidResponseModel();

            MyViewComponent <ViewResultComponent>
            .Instance()
            .InvokedWith(c => c.Invoke("All"))
            .ShouldReturn()
            .View(view => view
                  .WithModel(model));
        }
Example #2
0
        public void WithGenericModelShouldThrowExceptionWithIncorrectModel()
        {
            var model = TestObjectFactory.GetValidResponseModel();

            model.IntegerValue = 11;

            Test.AssertException <ResponseModelAssertionException>(
                () =>
            {
                MyViewComponent <ViewResultComponent>
                .Instance()
                .InvokedWith(c => c.Invoke("All"))
                .ShouldReturn()
                .View(view => view
                      .WithModel(model));
            },
                "When invoking ViewResultComponent expected response model ResponseModel to be the given model, but in fact it was a different one. Difference occurs at 'ResponseModel.IntegerValue'. Expected a value of '11', but in fact it was '10'.");
        }