本文整理匯總了C#中Catalog.FindByShortName方法的典型用法代碼示例。如果您正苦於以下問題:C# Catalog.FindByShortName方法的具體用法?C# Catalog.FindByShortName怎麽用?C# Catalog.FindByShortName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Catalog
的用法示例。
在下文中一共展示了Catalog.FindByShortName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TestFindByShortName
public void TestFindByShortName()
{
var appA = new Feed
{
Uri = FeedTest.Test1Uri, Name = "AppA",
EntryPoints = {new EntryPoint {Command = Command.NameRun, BinaryName = "BinaryA"}}
};
var appB = new Feed
{
Uri = FeedTest.Test2Uri, Name = "AppB",
EntryPoints = {new EntryPoint {Command = Command.NameRun, BinaryName = "BinaryB"}}
};
var catalog = new Catalog {Feeds = {appA, appA.Clone(), appB, appB.Clone()}};
Assert.IsNull(catalog.FindByShortName(""));
Assert.AreSame(expected: appA, actual: catalog.FindByShortName("AppA"));
Assert.AreSame(expected: appA, actual: catalog.FindByShortName("BinaryA"));
Assert.AreSame(expected: appB, actual: catalog.FindByShortName("AppB"));
Assert.AreSame(expected: appB, actual: catalog.FindByShortName("BinaryB"));
}
示例2: TestFindByShortName
public void TestFindByShortName()
{
var appA = new Feed
{
Uri = FeedTest.Test1Uri, Name = "AppA",
EntryPoints = {new EntryPoint {Command = Command.NameRun, BinaryName = "BinaryA"}}
};
var appB = new Feed
{
Uri = FeedTest.Test2Uri, Name = "AppB",
EntryPoints = {new EntryPoint {Command = Command.NameRun, BinaryName = "BinaryB"}}
};
var catalog = new Catalog {Feeds = {appA, appA.Clone(), appB, appB.Clone()}};
catalog.FindByShortName("").Should().BeNull();
catalog.FindByShortName("AppA").Should().BeSameAs(appA);
catalog.FindByShortName("BinaryA").Should().BeSameAs(appA);
catalog.FindByShortName("AppB").Should().BeSameAs(appB);
catalog.FindByShortName("BinaryB").Should().BeSameAs(appB);
}