Exemplo n.º 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);
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 6
0
Arquivo: JSON.cs Projeto: 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);
        }
Exemplo n.º 7
0
Arquivo: JSON.cs Projeto: 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);
        }