Example #1
0
        public void TitleFor404Page()
        {
            var titleRule = new TitleRule();
            var urlDto = GetValidTitle(EMPTY_TITLE);
            urlDto.Status = HttpStatusCode.NotFound;
            var result = titleRule.Analyze(null, urlDto);

            Assert.AreEqual(0, result.Count());
        }
Example #2
0
 public void HasTitle()
 {
     var sqlRepository = CreateInMemoryRespository();
     var titleRule = new TitleRule();
     var urlDto = GetValidTitle(VALID_TITLE1);
     sqlRepository.InsertOrUpdateUrl(urlDto);
     var result = titleRule.Analyze(sqlRepository, urlDto);
     Assert.AreEqual(0, result.Count());
 }
Example #3
0
        public void EmptyTitle()
        {
            var sqlRepository = CreateInMemoryRespository();
            var titleRule = new TitleRule();
            var urlDto = GetValidTitle(EMPTY_TITLE);
            sqlRepository.InsertOrUpdateUrl(urlDto);
            var result = titleRule.Analyze(sqlRepository, urlDto);

            var filtered = GetWarningOccurrencesOfType(result, typeof(EmptyTitleWarning));
            Assert.AreEqual(1, filtered.Count());
        }
Example #4
0
        public void NoDuplicatedTitle()
        {
            var sqlRepository = CreateInMemoryRespository();

            var titleRule = new TitleRule();

            var urlDto1 = GetValidTitle(VALID_TITLE1);
            var urlDto2 = GetValidTitle(VALID_TITLE2);
            sqlRepository.InsertOrUpdateUrl(urlDto1);
            sqlRepository.InsertOrUpdateUrl(urlDto2);
            var result = titleRule.Analyze(sqlRepository, urlDto1);
            var filtered = GetWarningOccurrencesOfType(result, typeof(DuplicatedTitleWarning));
            Assert.AreEqual(0, filtered.Count());
        }