Exemple #1
0
        private static void ParseVCard()
        {
            Console.WriteLine("Parsing a simple VCard");

            string root     = AppContext.BaseDirectory;
            string path     = Path.Combine(root, "../../../simple-serialized.vcf");
            var    expected = SampleVCards.GetSimple();

            var vcards = Deserializer.Deserialize(path).ToList();

            foreach (var actual in vcards)
            {
                TestValue(expected, actual);
            }

            Console.WriteLine("Parsing a complex VCard");

            path     = Path.Combine(root, "../../../complex-serialized.vcf");
            expected = SampleVCards.GetComplex();

            vcards = Deserializer.Deserialize(path).ToList();
            foreach (var actual in vcards)
            {
                TestValue(expected, actual);
            }
        }
Exemple #2
0
        private static void CreateVCard()
        {
            string root = AppContext.BaseDirectory;

            string path       = Path.Combine(root, "../../../complex-serialized.vcf");
            var    serialized = SampleVCards.GetComplex().Serialize();

            File.WriteAllText(path, serialized);


            path       = Path.Combine(root, "../../../simple-serialized.vcf");
            serialized = SampleVCards.GetSimple().Serialize();
            File.WriteAllText(path, serialized);
        }