예제 #1
0
        public void NLSMap_SerializeAll()
        {
            var content = "{eng: {n: 'Cucumber',d: 'It is green'}, deu: {n: 'Gurke', d: 'Es ist grün'}}";

            var nls = new NLSMap(content);

            var json = nls.ToJSON();

            Console.WriteLine(json);

            dynamic read = json.JSONToDynamic();

            Aver.IsNotNull(read);

            Aver.AreEqual("Cucumber", read.ENG.n);
            Aver.AreEqual("Gurke", read.DEU.n);
        }
예제 #2
0
        public void NLSMap_SerializeAll()
        {
            var content = "eng{n='Cucumber' d='It is green'} deu{n='Gurke' d='Es ist grün'}";

            var nls = new NLSMap(content);

            var json = nls.ToJSON();

            Console.WriteLine(json);

            dynamic read = json.JSONToDynamic();

            Assert.IsNotNull(read);

            Assert.AreEqual("Cucumber", read.eng.n);
            Assert.AreEqual("Gurke", read.deu.n);
        }
예제 #3
0
        public void NLSMap_JSONSerializationRoundtrip()
        {
            var content = "{eng: {n: 'Cucumber',d: 'It is green'}, deu: {n: 'Gurke', d: 'Es ist grün'}}";

            var nls = new NLSMap(content);


            var json = nls.ToJSON();

            Console.WriteLine(json);

            var nls2 = new NLSMap(json);

            Aver.AreEqual(2, nls2.Count);
            Aver.AreEqual("Cucumber", nls2["eng"].Name);
            Aver.AreEqual("Gurke", nls2["deu"].Name);
            Aver.AreEqual(null, nls["rus"].Name);
        }
예제 #4
0
        public void NLSMap_SerializeOnlyOneNoneExisting()
        {
            var content = "{eng: {n: 'Cucumber',d: 'It is green'}, deu: {n: 'Gurke', d: 'Es ist grün'}}";

            var nls = new NLSMap(content);


            var options = new JSONWritingOptions {
                NLSMapLanguageISO = "rus", Purpose = JSONSerializationPurpose.UIFeed
            };
            var json = nls.ToJSON(options);

            Console.WriteLine(json);

            dynamic read = json.JSONToDynamic();

            Aver.IsNotNull(read);

            Aver.AreEqual("Cucumber", read.n);
            Aver.AreEqual("It is green", read.d);
        }
예제 #5
0
        public void NLSMap_SerializeOnlyOneExisting()
        {
            var content = "eng{n='Cucumber' d='It is green'} deu{n='Gurke' d='Es ist grün'}";

            var nls = new NLSMap(content);


            var options = new JSONWritingOptions {
                NLSMapLanguageISO = "deu", Purpose = JSONSerializationPurpose.UIFeed
            };
            var json = nls.ToJSON(options);

            Console.WriteLine(json);

            dynamic read = json.JSONToDynamic();

            Assert.IsNotNull(read);

            Assert.AreEqual("Gurke", read.n);
            Assert.AreEqual("Es ist grün", read.d);
        }
예제 #6
0
파일: JSON.cs 프로젝트: yhhno/nfx
        public void NLSMap_SerializeOnlyOneNoneExisting()
        {
            var content="{eng: {n: 'Cucumber',d: 'It is green'}, deu: {n: 'Gurke', d: 'Es ist grün'}}";

            var nls = new NLSMap(content);

            var options = new JSONWritingOptions{ NLSMapLanguageISO = "rus", Purpose = JSONSerializationPurpose.UIFeed};
            var json = nls.ToJSON(options);
            Console.WriteLine(json);

            dynamic read = json.JSONToDynamic();
            Assert.IsNotNull(read);

            Assert.AreEqual("Cucumber", read.n);
            Assert.AreEqual("It is green", read.d);
        }
예제 #7
0
파일: JSON.cs 프로젝트: yhhno/nfx
        public void NLSMap_SerializeAll()
        {
            var content="{eng: {n: 'Cucumber',d: 'It is green'}, deu: {n: 'Gurke', d: 'Es ist grün'}}";

            var nls = new NLSMap(content);

            var json = nls.ToJSON();
            Console.WriteLine(json);

            dynamic read = json.JSONToDynamic();
            Assert.IsNotNull(read);

            Assert.AreEqual("Cucumber", read.eng.n);
            Assert.AreEqual("Gurke", read.deu.n);
        }