Beispiel #1
0
        public void JsonRoundTripTest(string filename)
        {
            var resourceFilename = Path.Join("Resources", filename + ".json");
            var jsonBom          = File.ReadAllText(resourceFilename);

            var bom = JsonBomDeserializer.Deserialize(jsonBom);

            jsonBom = JsonBomSerializer.Serialize(bom);

            Snapshot.Match(jsonBom, SnapshotNameExtension.Create(filename));
        }
Beispiel #2
0
        public void JsonRoundTripTest()
        {
            var resourceFilename = Path.Join("Resources", "bom.json");
            var jsonBom          = File.ReadAllText(resourceFilename);

            var bom = JsonBomDeserializer.Deserialize(jsonBom);

            jsonBom = JsonBomSerializer.Serialize(bom);

            Snapshot.Match(jsonBom);
        }
Beispiel #3
0
 public static CycloneDX.Models.v1_2.Bom BomDeserializer(string bom, BomFormat format)
 {
     if (format == BomFormat.Json)
     {
         return(JsonBomDeserializer.Deserialize(bom));
     }
     else if (format == BomFormat.Xml)
     {
         return(XmlBomDeserializer.Deserialize(bom));
     }
     else if (format == BomFormat.Csv)
     {
         return(CsvSerializer.Deserialize(bom));
     }
     throw new UnsupportedFormatException("Unsupported SBOM file format");
 }