本文整理汇总了C#中Package.Write方法的典型用法代码示例。如果您正苦于以下问题:C# Package.Write方法的具体用法?C# Package.Write怎么用?C# Package.Write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Package
的用法示例。
在下文中一共展示了Package.Write方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Can_write_package
public void Can_write_package()
{
var package =
new Package(new[] { "linux" }, "language", "MyPackage", "v1.1", "cmd", "My package", "My Description")
.AddPreInstallAction("action1")
.AddPreInstallAction("action2")
.AddDependency("Dep1", new[] {"v1","v2"})
.AddDependency("Dep2", new[] {"v1"})
.AddPostInstallAction("action3")
.AddPostInstallAction("action4");
Assert.That(
package.Write(),
Is.EqualTo(
"{" + NL +
"\t\"target\": \"language\"," + NL +
"\t\"id\": \"MyPackage\"," + NL +
"\t\"version\": \"v1.1\"," + NL +
"\t\"command\": \"cmd\"," + NL +
"\t\"name\": \"My package\"," + NL +
"\t\"description\": \"My Description\"," + NL +
"\t\"dependencies\":" + NL +
"\t\t[" + NL +
"\t\t\t{" + NL +
"\t\t\t\t\"id\": \"Dep1\"," + NL +
"\t\t\t\t\"versions\":" + NL +
"\t\t\t\t[" + NL +
"\t\t\t\t\t\"v1\"," + NL +
"\t\t\t\t\t\"v2\"" + NL +
"\t\t\t\t]" + NL +
"\t\t\t}," + NL +
"\t\t\t{" + NL +
"\t\t\t\t\"id\": \"Dep2\"," + NL +
"\t\t\t\t\"versions\":" + NL +
"\t\t\t\t[" + NL +
"\t\t\t\t\t\"v1\"" + NL +
"\t\t\t\t]" + NL +
"\t\t\t}" + NL +
"\t\t]," + NL +
"\t\"pre-install-actions\":" + NL +
"\t\t[" + NL +
"\t\t\t\"action1\"," + NL +
"\t\t\t\"action2\"" + NL +
"\t\t]," + NL +
"\t\"post-install-actions\":" + NL +
"\t\t[" + NL +
"\t\t\t\"action3\"," + NL +
"\t\t\t\"action4\"" + NL +
"\t\t]" + NL +
"}"));
}