Example #1
0
        public void CreateNavigationFieldController_CallTheReadAction_EnsuresTheModelIsProperlyCreated()
        {
            using (new ObjectFactoryContainerRegion())
            {
                this.RegisterResourceClasses();

                using (var controller = new DummyNavigationFieldController())
                {
                    var res   = controller.Read(new object()) as ViewResult;
                    var model = res.Model;
                    var navigationFieldModel = model as NavigationFieldViewModel;

                    var pages = navigationFieldModel.Pages;

                    // Assert: ensures model pages value is set correctly
                    Assert.AreEqual(1, pages.Count(), "The SerializedPages property of the model is not properly set");
                    Assert.AreEqual(Res.Get <FieldResources>().PageName + "1", pages.First().Title, "The SerializedPages property of the model is not properly set");
                }
            }
        }
Example #2
0
        public void CreateNavigationFieldController_CallTheWriteAction_CorrectViewIsUsed()
        {
            using (new ObjectFactoryContainerRegion())
            {
                this.RegisterResourceClasses();

                using (var controller = new DummyNavigationFieldController())
                {
                    var httpContext = new NavigationDummyHttpContext();
                    SystemManager.RunWithHttpContext(
                        httpContext,
                        () =>
                    {
                        var res = controller.Write(new object()) as ViewResult;

                        // Assert: the action uses the right view name
                        Assert.AreEqual("Read.Default", res.ViewName, "The requested view does not have the right name");
                    });
                }
            }
        }