コード例 #1
0
ファイル: BlogAliasTests.cs プロジェクト: ghjigan/Subtext
        public void GetBlogByAliasWithSubfolders()
        {
            var       repository = new DatabaseObjectProvider();
            Blog      blog1      = UnitTestHelper.CreateBlogAndSetupContext();
            Blog      blog2      = UnitTestHelper.CreateBlogAndSetupContext();
            string    host       = UnitTestHelper.GenerateUniqueString();
            BlogAlias alias1     = UnitTestHelper.CreateBlogAlias(blog1, host, UnitTestHelper.GenerateUniqueString());
            BlogAlias alias2     = UnitTestHelper.CreateBlogAlias(blog2, host, UnitTestHelper.GenerateUniqueString());

            repository.AddBlogAlias(alias1);
            repository.AddBlogAlias(alias2);

            Blog testBlog1 = repository.GetBlogByDomainAlias(alias1.Host, alias1.Subfolder, false);
            Blog testBlog2 = repository.GetBlogByDomainAlias(alias2.Host, alias2.Subfolder, false);

            Assert.AreEqual(blog1.Id, testBlog1.Id, "Found the wrong blog.");
            Assert.AreEqual(blog2.Id, testBlog2.Id, "Found the wrong blog.");
        }
コード例 #2
0
ファイル: BlogAliasTests.cs プロジェクト: ghjigan/Subtext
        public void CheckBlogNotReturnedWithoutAlias()
        {
            UnitTestHelper.CreateBlogAndSetupContext();
            var  repository = new DatabaseObjectProvider();
            Blog testBlog   = repository.GetBlogByDomainAlias(UnitTestHelper.GenerateUniqueString(),
                                                              UnitTestHelper.GenerateUniqueString(), false);

            Assert.IsNull(testBlog);
        }
コード例 #3
0
ファイル: BlogAliasTests.cs プロジェクト: ghjigan/Subtext
        public void GetBlogByAliasNoSubfolder()
        {
            var       repository = new DatabaseObjectProvider();
            Blog      blog       = UnitTestHelper.CreateBlogAndSetupContext();
            BlogAlias alias      = UnitTestHelper.CreateBlogAlias(blog, UnitTestHelper.GenerateUniqueString(), "");

            repository.AddBlogAlias(alias);
            Blog testBlog = repository.GetBlogByDomainAlias(alias.Host, alias.Subfolder, false);

            Assert.AreEqual(blog.Id, testBlog.Id, "Found the wrong blog.");
        }
コード例 #4
0
ファイル: BlogAliasTests.cs プロジェクト: ghjigan/Subtext
        public void CheckThatAliasChecksSubfolderIfBlogOnSameHost()
        {
            var       repository = new DatabaseObjectProvider();
            Blog      blog       = UnitTestHelper.CreateBlogAndSetupContext();
            BlogAlias alias      = UnitTestHelper.CreateBlogAlias(blog, blog.Host, UnitTestHelper.GenerateUniqueString());

            repository.AddBlogAlias(alias);

            Blog testBlog = repository.GetBlogByDomainAlias(blog.Host, "", false);

            Assert.IsNull(testBlog, "Should not have found a blog, alias is on same host.");
        }
コード例 #5
0
ファイル: BlogAliasTests.cs プロジェクト: ghjigan/Subtext
        public void CheckBlogNotReturnedWithInactiveAlias()
        {
            var       repository = new DatabaseObjectProvider();
            Blog      blog       = UnitTestHelper.CreateBlogAndSetupContext();
            BlogAlias alias      = UnitTestHelper.CreateBlogAlias(blog, UnitTestHelper.GenerateUniqueString(), "", false);

            BlogAlias testAlias = repository.GetBlogAlias(alias.Id);
            Blog      testBlog  = repository.GetBlogByDomainAlias(alias.Host, alias.Subfolder, false);

            Assert.AreNotEqual(NullValue.NullInt32, alias.Id, "Alias was not saved.");
            Assert.AreEqual(alias.Id, testAlias.Id, "The test alias is not the alias saved.");
            Assert.IsFalse(testAlias.IsActive, "This alias is active.");
            Assert.IsNull(testBlog, "Should not have found a blog");
        }