public void Title_WhenCalledWithNoContentFromContentRouteHelper_ShouldReturnEmpty()
        {
            _contentRouteHelperMock.Setup(c=>c.Content).Returns( () => null);
            var subject = new HeadController(null, _contentRouteHelperMock.Object);
            var result = subject.Title();

            Assert.AreEqual<string>(string.Empty, ((ContentResult)result).Content);
        }
        public void Title_WhenCalledWithStartPageWithTitle_ShouldReturnTitle()
        {
            _startPageMock.Setup(c => c.Title).Returns("Title");

            _contentRouteHelperMock.Setup(c => c.Content).Returns(() => _startPageMock.Object);
            var subject = new HeadController(null, _contentRouteHelperMock.Object);
            var result = subject.Title();

            Assert.AreEqual<string>("Title", ((ContentResult)result).Content);
        }
        public void Title_WhenCalledWithNodeContentWithSeoTitle_ShouldReturnFormatSeoTitle()
        {
            var seoInformation = new SeoInformation()
            {
                Title = "Seo Tittle"
            };

            _nodeContentMock.Setup(c => c.SeoInformation).Returns(seoInformation);
            _contentRouteHelperMock.Setup(c => c.Content).Returns(() => _nodeContentMock.Object);

            var subject = new HeadController(SetupContentLoader().Object, _contentRouteHelperMock.Object);
            var result = subject.Title();

            Assert.AreEqual<string>("Seo Tittle-Quicksilver", ((ContentResult)result).Content);
        }
        public void Title_WhenCalledWithNodeContentWithoutSeoTitle_ShouldReturnFormatName()
        {
            var seoInformation = new SeoInformation()
            {
                Description = "Without seo title"
            };

            _nodeContentMock.Setup(c => c.SeoInformation).Returns(seoInformation);
            _nodeContentMock.Setup(c => c.DisplayName).Returns("Display Name");
            _contentRouteHelperMock.Setup(c => c.Content).Returns(() => _nodeContentMock.Object);

            var subject = new HeadController(SetupContentLoader().Object, _contentRouteHelperMock.Object);
            var result = subject.Title();

            Assert.Equal<string>("Display Name-Quicksilver", ((ContentResult)result).Content);
        }
        public void Title_WhenCalledWithEntryContentBaseBeneathCatalogEntry_ShouldReturnFormatContainsCatalogName()
        {
            var expectedTitle = "Fashion Catalog";

            var seoInformation = new SeoInformation()
            {
                Description = "Entry Seo"
            };

            _entryContentMock.Setup(c => c.SeoInformation).Returns(seoInformation);
            _entryContentMock.Setup(c => c.DisplayName).Returns("Entry");
            _catalogContentMock.Setup(c => c.Name).Returns("Fashion Catalog");

            var contentLoaderMock = SetupContentLoader();
            contentLoaderMock.Setup(c => c.Get<CatalogContentBase>(It.IsAny<ContentReference>())).Returns(_catalogContentMock.Object);
            _contentRouteHelperMock.Setup(c => c.Content).Returns(() => _entryContentMock.Object);

            var subject = new HeadController(contentLoaderMock.Object, _contentRouteHelperMock.Object);
            var result = subject.Title();
            Assert.Contains(expectedTitle, ((ContentResult)result).Content);
        }
        public void Title_WhenCalledWithEntryContentBaseWithSeoTitle_ShouldReturnFormatTitleOfNodeAndEntry()
        {
            var seoInformation = new SeoInformation()
            {
                Title = "Entry Seo Tittle"
            };
            _entryContentMock.Setup(c => c.SeoInformation).Returns(seoInformation);

            var nodeSeoInformation = new SeoInformation()
            {
                Title = "Node Seo Tittle"
            };

            _nodeContentMock.Setup(c => c.SeoInformation).Returns(nodeSeoInformation);
            var contentLoaderMock = SetupContentLoader();
            contentLoaderMock.Setup(c => c.Get<CatalogContentBase>(It.IsAny<ContentReference>())).Returns(_nodeContentMock.Object);
            _contentRouteHelperMock.Setup(c => c.Content).Returns(() => _entryContentMock.Object);

            var subject = new HeadController(contentLoaderMock.Object, _contentRouteHelperMock.Object);
            var result = subject.Title();

            Assert.Equal<string>("Entry Seo Tittle - Node Seo Tittle-Quicksilver", ((ContentResult)result).Content);
        }