示例#1
0
        public void Post_returns_PersonalDetails_ModelsBuilder_model()
        {
            using (var controller = new PersonalDetailsController(Mock.Of <IGlobalSettings>(),
                                                                  Mock.Of <IUmbracoContextAccessor>(),
                                                                  ServiceContext,
                                                                  AppCaches.NoCache,
                                                                  Mock.Of <IProfilingLogger>(),
                                                                  UmbracoHelper))
            {
                var currentPage = new Mock <IPublishedContent>();
                SetupPropertyValue(currentPage, "description", string.Empty);

                var result = controller.PersonalDetails(new ContentModel(currentPage.Object));

                Assert.IsType <PersonalDetails>(((ViewResult)result).Model);
            }
        }
示例#2
0
        public void Post_sets_name_and_description_from_content()
        {
            using (var controller = new PersonalDetailsController(Mock.Of <IGlobalSettings>(),
                                                                  Mock.Of <IUmbracoContextAccessor>(),
                                                                  ServiceContext,
                                                                  AppCaches.NoCache,
                                                                  Mock.Of <IProfilingLogger>(),
                                                                  UmbracoHelper))
            {
                var currentPage = new Mock <IPublishedContent>();
                currentPage.Setup(x => x.Name).Returns("Personal details");
                SetupPropertyValue(currentPage, "description", "This is the description");

                var result = controller.PersonalDetails(new ContentModel(currentPage.Object));

                var meta = ((IHasViewMetadata)((ViewResult)result).Model).Metadata;
                Assert.Equal("Personal details", meta.PageTitle);
                Assert.Equal("This is the description", meta.Description);
            }
        }