Esempio n. 1
0
        public static void TestIssue22()
        {
            NSDictionary x1 = (NSDictionary)PropertyListParser.Parse(new FileInfo("test-files/issue22-emoji.plist"));
            NSDictionary x2 =
                (NSDictionary)PropertyListParser.Parse(new FileInfo("test-files/issue22-emoji-xml.plist"));

            PropertyListParser.SaveAsBinary(x1, new FileInfo("test-files/out-testIssue22.plist"));
            NSDictionary y1 = (NSDictionary)PropertyListParser.Parse(new FileInfo("test-files/out-testIssue22.plist"));

            PropertyListParser.SaveAsXml(x2, new FileInfo("test-files/out-testIssue22-xml.plist"));
            NSDictionary y2 =
                (NSDictionary)PropertyListParser.Parse(new FileInfo("test-files/out-testIssue22-xml.plist"));

            Assert.True(x1.Equals(x2));
            Assert.True(x1.Equals(y1));
            Assert.True(x1.Equals(y2));
            Assert.True(x2.Equals(y1));
            Assert.True(x2.Equals(y2));

            string emojiString = "Test Test, \uD83D\uDE30\u2754\uD83D\uDC4D\uD83D\uDC4E\uD83D\uDD25";

            Assert.Equal(emojiString, x1.ObjectForKey("emojiString").ToString());
            Assert.Equal(emojiString, x2.ObjectForKey("emojiString").ToString());
            Assert.Equal(emojiString, y1.ObjectForKey("emojiString").ToString());
            Assert.Equal(emojiString, y2.ObjectForKey("emojiString").ToString());
        }
Esempio n. 2
0
        public static void TestGnuStepASCIIWriting()
        {
            FileInfo     inf  = new FileInfo("test-files/test1.plist");
            FileInfo     outf = new FileInfo("test-files/out-test1-ascii-gnustep.plist");
            NSDictionary x    = (NSDictionary)PropertyListParser.Parse(inf);

            PropertyListParser.SaveAsGnuStepASCII(x, outf);
            NSObject y = PropertyListParser.Parse(outf);

            Assert.True(x.Equals(y));
        }
Esempio n. 3
0
        public static void TestASCIIWriting()
        {
            FileInfo     inf  = new FileInfo("test-files/test1.plist");
            FileInfo     outf = new FileInfo("test-files/out-test1-ascii.plist");
            FileInfo     in2  = new FileInfo("test-files/test1-ascii.plist");
            NSDictionary x    = (NSDictionary)PropertyListParser.Parse(inf);

            PropertyListParser.SaveAsASCII(x, outf);

            //Information gets lost when saving into the ASCII format (NSNumbers are converted to NSStrings)

            NSDictionary y = (NSDictionary)PropertyListParser.Parse(outf);
            NSDictionary z = (NSDictionary)PropertyListParser.Parse(in2);

            Assert.True(y.Equals(z));
        }