本文整理汇总了C#中IUrlParser.BuildUrl方法的典型用法代码示例。如果您正苦于以下问题:C# IUrlParser.BuildUrl方法的具体用法?C# IUrlParser.BuildUrl怎么用?C# IUrlParser.BuildUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUrlParser
的用法示例。
在下文中一共展示了IUrlParser.BuildUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public override void SetUp()
{
base.SetUp();
finder = new FakeTypeFinder(typeof(XmlableItem).Assembly, typeof(XmlableItem), typeof(XmlableItem2));
notifier = mocks.Stub<IItemNotifier>();
mocks.Replay(notifier);
activator = new ContentActivator(new N2.Edit.Workflow.StateChanger(), notifier, new InterceptingProxyFactory());
definitions = new DefinitionManager(
new[] {new DefinitionProvider(new DefinitionBuilder(new DefinitionMap(),
finder,
new TransformerBase<IUniquelyNamed>[0],
TestSupport.SetupEngineSection()))},
activator, new StateChanger(), new DefinitionMap());
definitions.Start();
parser = mocks.StrictMock<IUrlParser>();
Expect.On(parser)
.Call(parser.BuildUrl(null))
.IgnoreArguments()
.Do(new BuildUrl(delegate(ContentItem itemToBuild)
{
string url = "/" + itemToBuild.Name + ".aspx";
foreach (ContentItem parent in Find.EnumerateParents(itemToBuild, null))
{
if (parent.Parent != null)
url = "/" + parent.Name + url;
}
return url.ToUrl();
}))
.Repeat.Any();
mocks.Replay(parser);
persister = TestSupport.SetupFakePersister();
}
示例2: SetUp
public override void SetUp()
{
base.SetUp();
finder = new FakeTypeFinder(typeof(XmlableItem).Assembly, typeof(XmlableItem), typeof(XmlableItem2));
notifier = mocks.Stub<IItemNotifier>();
mocks.Replay(notifier);
definitions = new DefinitionManager(
new DefinitionBuilder(
finder,
new EngineSection(),
new FakeEditUrlManager()),
new N2.Edit.Workflow.StateChanger(),
notifier,
new InterceptingProxyFactory());
parser = mocks.StrictMock<IUrlParser>();
Expect.On(parser)
.Call(parser.BuildUrl(null))
.IgnoreArguments()
.Do(new BuildUrl(delegate(ContentItem itemToBuild)
{
string url = "/" + itemToBuild.Name + ".aspx";
foreach (ContentItem parent in Find.EnumerateParents(itemToBuild, null))
{
if (parent.Parent != null)
url = "/" + parent.Name + url;
}
return url;
}))
.Repeat.Any();
mocks.Replay(parser);
persister = mocks.StrictMock<IPersister>();
persister.Save(null);
LastCall.IgnoreArguments().Repeat.Any();
mocks.Replay(persister);
}