Пример #1
0
        public void EncodeData_RoundtripOfArbitraryString_DecodedDataMatchesOriginal()
        {
            string original = "drs;gkljsdr;lgsd";
            string decoded  = JSONUtils.DecodeData(JSONUtils.EncodeData(original));

            Assert.AreEqual(original, decoded);
        }
Пример #2
0
        public void DecodeData_JsonData_ReturnsDecodedString()
        {
            string encoded =
                "eyJpZCI6InUzZDJ1aG5mcnUiLCJjcmVhdGVkX2F0IjoiVHVlLCAxMyBBdWcgMjAxMyAxNDozMDo0NSBHTVQiLCJyYW1wLmlzX3JlYWR5IjoiWSIsImRjLnRpdGxlIjoiRmllbGRXb3JrcyBUZXN0IExhbmd1YWdlIFByb2plY3QiLCJicm9hZF90eXBlIjoid2lkZXJfYXVkaWVuY2UiLCJkYy50eXBlLnNjaG9sYXJseVdvcmsiOiJEYXRhIHNldCIsImRjLnN1YmplY3Quc2lsRG9tYWluIjpbIkxJTkc6TGluZ3Vpc3RpY3MiXSwidHlwZS5kb21haW5TdWJ0eXBlLkxJTkciOlsibGV4aWNvbiAoTElORykiXSwiZGMuZGF0ZS5jcmVhdGVkIjoiOC8xMy8yMDEzIiwiZmlsZXMiOnsiMCI6eyIgIjoiVGVzdExhbmdQcm9qKzIwMTMtMDgtMTMrMDkxNy5md2JhY2t1cCIsImRlc2NyaXB0aW9uIjoiRmllbGRXb3JrcyBiYWNrdXAiLCJyZWxhdGlvbnNoaXAiOiJzb3VyY2UifX0sImRjLnR5cGUubW9kZSI6WyJNdXNpY2FsIG5vdGF0aW9uIiwiUHJlc2VudGF0aW9uIiwiU29mdHdhcmUgYXBwbGljYXRpb24iLCJEYXRhc2V0Il0sImRjLmRlc2NyaXB0aW9uLnN0YWdlIjoicm91Z2hfZHJhZnQiLCJzaWwuc2Vuc2l0aXZpdHkubWV0YWRhdGEiOiJFbnRpdHkgY3VyYXRvcnMiLCJzdGF0dXMiOiJyZWFkeSJ9";
            string decoded = JSONUtils.DecodeData(encoded);

            Console.Out.WriteLine(decoded);
            Assert.AreEqual("{\"id\":\"u3d2uhnfru\",\"created_at\":\"Tue, 13 Aug 2013 14:30:45 GMT\",\"ramp.is_ready\":\"Y\",\"dc.title\":\"FieldWorks Test Language Project\",\"broad_type\":\"wider_audience\",\"dc.type.scholarlyWork\":\"Data set\",\"dc.subject.silDomain\":[\"LING:Linguistics\"],\"type.domainSubtype.LING\":[\"lexicon (LING)\"],\"dc.date.created\":\"8/13/2013\",\"files\":{\"0\":{\" \":\"TestLangProj+2013-08-13+0917.fwbackup\",\"description\":\"FieldWorks backup\",\"relationship\":\"source\"}},\"dc.type.mode\":[\"Musical notation\",\"Presentation\",\"Software application\",\"Dataset\"],\"dc.description.stage\":\"rough_draft\",\"sil.sensitivity.metadata\":\"Entity curators\",\"status\":\"ready\"}",
                            decoded);
        }