Пример #1
0
        public void Test_Serialize_Deserialize()
        {
            string test = "this_is_a_test";
            object[] o = { test };
            string a = JsonConvert.SerializeObject(o);
            string b = JsonConvert.SerializeObject(o.ToArray());
            string t = a.ToString();
            string t1 = b.ToString();

            Url entity = new Url();
            entity.Href = "http://www.test.com";

            UrlRepository repo = new UrlRepository();
            string json = repo.Serialize(entity);
            Assert.IsNotNull(json);

            Url result = repo.Deserialize(json);
            Assert.IsNotNull(result);
            Assert.IsTrue(entity.Href.Equals(result.Href));
        }
Пример #2
0
        public void Test_Serialize_Deserialize()
        {
            string test = "this_is_a_test";
            object[] o = { test };
            string a = JsonConvert.SerializeObject(o);
            string b = JsonConvert.SerializeObject(o.ToArray());
            string t = a.ToString();
            string t1 = b.ToString();

            Url entity = new Url();
            entity.Href = "http://www.test.com";

            UrlRepository repo = new UrlRepository();
            string json = repo.Serialize(entity);
            Assert.IsNotNull(json);

            Url result = repo.Deserialize(json);
            Assert.IsNotNull(result);
            Assert.IsTrue(entity.Href.Equals(result.Href));
        }