コード例 #1
0
 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);
     }
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
        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);
            }
        }