Ejemplo n.º 1
0
        public void Test_AccountJSONPresenter_Properties()
        {
            Account account;

            account = new Account();
            Dictionary <string, string> properties = new Dictionary <string, string>();

            properties.Add("Title", "Mr.");
            properties.Add("GivenName", "John");
            properties.Add("FamilyName", "Smith");
            properties.Add("Zip", "123");
            properties.Add("Address", "Internetstrasse 42");
            properties.Add("Phone", "+00 123 456 789 0");
            properties.Add("Email", "*****@*****.**");

            foreach (KeyValuePair <string, string> entry in properties)
            {
                account[entry.Key] = (string)entry.Value;
            }

            var    presenter  = new AccountJSONPresenter(account);
            string resultJSON = Serializer.Serialize(presenter);

            foreach (KeyValuePair <string, string> entry in properties)
            {
                Assert.IsTrue(resultJSON.Contains(entry.Value));
            }

            Assert.IsTrue(resultJSON.Contains(account.Signature));
        }
Ejemplo n.º 2
0
        public void Test_AccountJSONPresenter_Serializability()
        {
            Account account;

            account = new Account();
            var presenter = new AccountJSONPresenter(account);
            var expected  = ExpectedJSONWithObject(account);

            string resultJSON = Serializer.Serialize(presenter);

            Assert.AreEqual(expected, resultJSON);
            Assert.IsTrue(Serializer.Deserialize <Account>(resultJSON) is Account);
        }