public void TestBuild()
{
TestCalculateDigest();
TestDetectCandidates();
TestGenerateCommands();
_builder.RetrievalMethod = new Archive();
_builder.Uri = new FeedUri("http://0install.de/feeds/test/test1.xml");
_builder.Icons.Add(new Icon {
MimeType = Icon.MimeTypePng, Href = new Uri("http://0install.de/test.png")
});
_builder.Icons.Add(new Icon {
MimeType = Icon.MimeTypeIco, Href = new Uri("http://0install.de/test.ico")
});
_builder.SecretKey = new OpenPgpSecretKey("fingerprint", "key", "user", new DateTime(2000, 1, 1), OpenPgpAlgorithm.Rsa, 1024);
var signedFeed = _builder.Build();
Assert.AreEqual(expected: _builder.MainCandidate.Name, actual: signedFeed.Feed.Name);
Assert.AreEqual(expected: _builder.Uri, actual: signedFeed.Feed.Uri);
CollectionAssert.AreEqual(
expected: new LocalizableStringCollection {
_builder.MainCandidate.Summary
},
actual: signedFeed.Feed.Summaries);
Assert.AreEqual(expected: _builder.MainCandidate.NeedsTerminal, actual: signedFeed.Feed.NeedsTerminal);
CollectionAssert.AreEqual(
expected: new[]
{
new Implementation
{
ID = "sha1new=" + ManifestDigest.Empty.Sha1New,
ManifestDigest = ManifestDigest.Empty,
Version = _builder.MainCandidate.Version,
Architecture = _builder.MainCandidate.Architecture,
Commands = { new Command {
Name = Command.NameRun, Path = "test"
} },
RetrievalMethods = { _builder.RetrievalMethod }
}
},
actual: signedFeed.Feed.Elements);
CollectionAssert.AreEqual(expected: _builder.Icons, actual: signedFeed.Feed.Icons);
CollectionAssert.IsEmpty(signedFeed.Feed.EntryPoints, "Should not generate entry points if there is only a single command");
Assert.AreEqual(expected: _builder.SecretKey, actual: signedFeed.SecretKey);
}