public async Task Post_child_view_model_and_bind_to_parent_on_postback_taghelpers()
        {
            var enteredViewModel = ObjectMother.ChangingContextViewModels.ParentViewModel;

            var page = await _client.GetPageAsync <ChangingContextPage>("/ExampleForms/ChangingContextTH");

            page = await page.PostParentModelAsync(enteredViewModel);

            IsSame.ViewModelAs(enteredViewModel, page.ReadParentModel());
            page.HasValidationErrors().ShouldBeFalse();
        }
        public void Function_correctly_with_checkbox_and_radio_lists()
        {
            var enteredViewModel = ObjectMother.ModelBindingViewModels.BasicValid;

            var page = SelenoHost.NavigateToInitialPage <HomePage>()
                       .GoToModelBindingExamplePage2()
                       .Submit(enteredViewModel);

            Assert.That(page.GetFormValues(), IsSame.ViewModelAs(enteredViewModel));
            Assert.That(page.HasValidationErrors(), Is.False, "There are validation errors on the page");
        }
        public void Function_correctly_with_default_form()
        {
            var enteredViewModel = ObjectMother.ModelBindingViewModels.BasicValid;

            var page = Host.Instance.NavigateToInitialPage <HomePage>()
                       .GoToModelBindingExamplePage()
                       .Submit(enteredViewModel);

            Assert.That(page.GetFormValues(), IsSame.ViewModelAs(enteredViewModel));
            Assert.That(page.HasValidationErrors(), Is.False, "There are validation errors on the page");
        }
Exemplo n.º 4
0
        public void Post_child_view_model_and_bind_to_parent_on_postback()
        {
            var enteredViewModel = ObjectMother.ChangingContextViewModels.ParentViewModel;

            var page = Host.Instance.NavigateToInitialPage <HomePage>()
                       .GoToChangingContextPage2()
                       .PostParentModel(enteredViewModel);

            Assert.That(page.ReadParentModel(), IsSame.ViewModelAs(enteredViewModel));
            Assert.That(page.HasValidationErrors(), Is.False, "There are validation errors on the page");
        }
Exemplo n.º 5
0
        public ActionResult ExpectFixtureA(Form1ViewModel vm)
        {
            try
            {
                Assert.That(vm, IsSame.ViewModelAs(Form1Fixtures.A));
            }
            catch (Exception e)
            {
                return(new ContentResult {
                    Content = e.ToString(), ContentType = "text/plain"
                });
            }

            return(new EmptyResult());
        }
Exemplo n.º 6
0
        public ActionResult ExpectFixtureA(Form1ViewModel vm)
        {
            try
            {
                Assert.That(vm, IsSame.ViewModelAs(Form1Fixtures.A));
            }
            catch (Exception e)
            {
                return(View("ExpectedFixtureAResult", new ExceptionViewModel
                {
                    Exception = e
                }));
            }

            return(new EmptyResult());
        }
Exemplo n.º 7
0
        public async Task Function_correctly_with_checkbox_and_radio_lists()
        {
            var enteredViewModel = ObjectMother.ModelBindingViewModels.BasicValid;

            var page = await _client.GetPageAsync <ModelBindingExamplePage>("/ExampleForms/ModelBindingExample2");

            var pageAfterPostback = await page.SubmitAsync(enteredViewModel);

            _output.WriteLine("### Debug output - POST contents:");
            _postCapture.Posts.ToList().ForEach(p => _output.WriteLine(p));
            _output.WriteLine("###");
            _output.WriteLine("### Debug output - Page HTML after postback:");
            _output.WriteLine(pageAfterPostback.Source);
            _output.WriteLine("###");
            IsSame.ViewModelAs(enteredViewModel, pageAfterPostback.GetFormValues());
            page.HasValidationErrors().ShouldBeFalse();
        }
Exemplo n.º 8
0
 public void Then_the_model_should_match_the_model_used_to_fill_the_form()
 {
     Assert.That(_viewModel, IsSame.ViewModelAs(Form1Fixtures.A));
 }