当前位置: 首页>>代码示例>>C#>>正文


C# DatabaseObjectProvider.AddBlogAlias方法代码示例

本文整理汇总了C#中Subtext.Framework.Data.DatabaseObjectProvider.AddBlogAlias方法的典型用法代码示例。如果您正苦于以下问题:C# DatabaseObjectProvider.AddBlogAlias方法的具体用法?C# DatabaseObjectProvider.AddBlogAlias怎么用?C# DatabaseObjectProvider.AddBlogAlias使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Subtext.Framework.Data.DatabaseObjectProvider的用法示例。


在下文中一共展示了DatabaseObjectProvider.AddBlogAlias方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckThatAliasChecksSubfolderIfBlogOnSameHost

        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.");
        }
开发者ID:rhoadsce,项目名称:Subtext,代码行数:11,代码来源:BlogAliasTests.cs

示例2: CreateBlogAlias

        public void CreateBlogAlias()
        {
            // Arrange
            Blog blog = UnitTestHelper.CreateBlogAndSetupContext();
            var repository = new DatabaseObjectProvider();
            var alias = new BlogAlias();
            alias.BlogId = blog.Id;
            alias.Host = UnitTestHelper.GenerateUniqueString();
            alias.Subfolder = UnitTestHelper.GenerateUniqueString();

            // Act
            repository.AddBlogAlias(alias);

            // Assert
            Assert.AreNotEqual(alias.Id, NullValue.NullInt32);
        }
开发者ID:rhoadsce,项目名称:Subtext,代码行数:16,代码来源:BlogAliasTests.cs

示例3: DeleteBlogAlias

        public void DeleteBlogAlias()
        {
            Blog blog = UnitTestHelper.CreateBlogAndSetupContext();
            var repository = new DatabaseObjectProvider();
            BlogAlias alias1 = UnitTestHelper.CreateBlogAlias(blog, UnitTestHelper.GenerateUniqueString(),
                                                              UnitTestHelper.GenerateUniqueString());
            BlogAlias alias2 = UnitTestHelper.CreateBlogAlias(blog, UnitTestHelper.GenerateUniqueString(),
                                                              UnitTestHelper.GenerateUniqueString());
            repository.AddBlogAlias(alias1);
            repository.AddBlogAlias(alias2);

            repository.DeleteBlogAlias(alias1);

            BlogAlias testAlias1 = repository.GetBlogAlias(alias1.Id);
            BlogAlias testAlias2 = repository.GetBlogAlias(alias2.Id);

            Assert.IsNull(testAlias1, "Did not delete the alias.");
            Assert.IsNotNull(testAlias2, "Deleted the wrong one");
        }
开发者ID:rhoadsce,项目名称:Subtext,代码行数:19,代码来源:BlogAliasTests.cs

示例4: UpdateBlogAlias

        public void UpdateBlogAlias()
        {
            var repository = new DatabaseObjectProvider();
            Blog blog = UnitTestHelper.CreateBlogAndSetupContext();
            string host1 = UnitTestHelper.GenerateUniqueString();
            string host2 = UnitTestHelper.GenerateUniqueString();

            BlogAlias alias = UnitTestHelper.CreateBlogAlias(blog, host1, "");
            repository.AddBlogAlias(alias);

            BlogAlias testAlias = repository.GetBlogAlias(alias.Id);
            testAlias.Host = host2;

            repository.UpdateBlogAlias(testAlias);

            BlogAlias testAlias2 = repository.GetBlogAlias(alias.Id);

            Assert.AreEqual(alias.Id, testAlias.Id, "Did not retrieve the correct alias.");
            Assert.AreEqual(alias.Id, testAlias2.Id, "Did not retrieve the correct alias.");
            Assert.AreEqual(host2, testAlias2.Host, "Alias was not updated");
        }
开发者ID:rhoadsce,项目名称:Subtext,代码行数:21,代码来源:BlogAliasTests.cs

示例5: GetBlogByAliasWithSubfolders

        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.");
        }
开发者ID:rhoadsce,项目名称:Subtext,代码行数:18,代码来源:BlogAliasTests.cs

示例6: GetBlogByAliasNoSubfolder

        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.");
        }
开发者ID:rhoadsce,项目名称:Subtext,代码行数:10,代码来源:BlogAliasTests.cs

示例7: GetBlogAliasById

        public void GetBlogAliasById()
        {
            var repository = new DatabaseObjectProvider();
            Blog blog = UnitTestHelper.CreateBlogAndSetupContext();
            BlogAlias alias = UnitTestHelper.CreateBlogAlias(blog, UnitTestHelper.GenerateUniqueString(),
                                                             UnitTestHelper.GenerateUniqueString());

            repository.AddBlogAlias(alias);

            BlogAlias testAlias = repository.GetBlogAlias(alias.Id);

            Assert.AreEqual(alias.Id, testAlias.Id, "Found the wrong alias.");
        }
开发者ID:rhoadsce,项目名称:Subtext,代码行数:13,代码来源:BlogAliasTests.cs

示例8: GetBlogAliasByBlog

        public void GetBlogAliasByBlog()
        {
            var repository = new DatabaseObjectProvider();
            string host = UnitTestHelper.GenerateUniqueString();
            Blog blog1 = UnitTestHelper.CreateBlogAndSetupContext();
            Blog blog2 = UnitTestHelper.CreateBlogAndSetupContext();
            var alias1 = new BlogAlias();
            alias1.BlogId = blog1.Id;
            alias1.Host = host;

            var alias2 = new BlogAlias();
            alias2.BlogId = blog2.Id;
            alias2.Host = host;
            alias2.Subfolder = UnitTestHelper.GenerateUniqueString();

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

            IPagedCollection<BlogAlias> aliases = blog1.GetBlogAliases(new DatabaseObjectProvider(), 0, 10);
            Assert.AreEqual(1, aliases.Count);
            Assert.AreEqual(alias1.Id, aliases[0].Id);
            Assert.IsEmpty(alias1.Subfolder);
        }
开发者ID:rhoadsce,项目名称:Subtext,代码行数:23,代码来源:BlogAliasTests.cs

示例9: CreateBlogCannotCreateBlogWithHostThatIsDuplicateOfAnotherBlogAlias

        public void CreateBlogCannotCreateBlogWithHostThatIsDuplicateOfAnotherBlogAlias()
        {
            var repository = new DatabaseObjectProvider();
            repository.CreateBlog("title", "username", "password", _hostName, string.Empty);
            var alias = new BlogAlias { Host = "example.com", IsActive = true, BlogId = repository.GetBlog(_hostName, string.Empty).Id };
            repository.AddBlogAlias(alias);

            UnitTestHelper.AssertThrows<BlogDuplicationException>(() => repository.CreateBlog("title", "username2", "password2", "example.com", string.Empty));
        }
开发者ID:rsaladrigas,项目名称:Subtext,代码行数:9,代码来源:BlogCreationTests.cs


注:本文中的Subtext.Framework.Data.DatabaseObjectProvider.AddBlogAlias方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。