public void XmlTest() { using (CaptureConsole) { var tag = SoftwareIdentity.LoadXml(File.ReadAllText("Samples\\swid.feed.xml")); Assert.NotNull(tag); Console.WriteLine(tag.SwidTagXml); Console.WriteLine(tag.SwidTagJson); } }
public void ParameterizedDiscoveryTest() { using (CaptureConsole) { var tag = SoftwareIdentity.LoadXml(File.ReadAllText("Samples\\ParameterizedDiscovery.feed.swidtag")); Assert.NotNull(tag); Console.WriteLine(tag.SwidTagXml); Console.WriteLine(tag.SwidTagJson); } }
public void RemoveLinkTest() { using (CaptureConsole) { var tag = SoftwareIdentity.LoadXml(File.ReadAllText("Samples\\swid.feed.xml")); Console.WriteLine(tag.SwidTagXml); tag.RemoveLink(tag.Links.FirstOrDefault().HRef); Console.WriteLine(tag.SwidTagXml); var j = tag.SwidTagJson; Console.WriteLine(j); var newtag = SoftwareIdentity.LoadJson(j); var xtag = SoftwareIdentity.LoadXml(tag.SwidTagXml); Console.WriteLine(newtag.SwidTagJson); Console.WriteLine(xtag.SwidTagJson); Assert.Equal(newtag.SwidTagJson, xtag.SwidTagJson); Console.WriteLine(newtag.SwidTagXml); Console.WriteLine(xtag.SwidTagXml); Console.WriteLine(xtag.SwidTagJson); var a1 = SoftwareIdentity.LoadXml(newtag.SwidTagXml); var a2 = SoftwareIdentity.LoadXml(xtag.SwidTagXml); var a3 = a1.SwidTagJson; var a4 = a2.SwidTagJson; var aa = SoftwareIdentity.LoadJson(a3); var bb = SoftwareIdentity.LoadJson(a4); var cc = aa.SwidTagXml; var dd = bb.SwidTagXml; Assert.Equal(cc, dd); } }