本文整理汇总了C#中Subtext.Framework.Data.DatabaseObjectProvider.GetBlogAlias方法的典型用法代码示例。如果您正苦于以下问题:C# DatabaseObjectProvider.GetBlogAlias方法的具体用法?C# DatabaseObjectProvider.GetBlogAlias怎么用?C# DatabaseObjectProvider.GetBlogAlias使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subtext.Framework.Data.DatabaseObjectProvider
的用法示例。
在下文中一共展示了DatabaseObjectProvider.GetBlogAlias方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckBlogNotReturnedWithInactiveAlias
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");
}
示例2: 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");
}
示例3: 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");
}
示例4: 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.");
}