public void Test_ConactJSONPresenter_Properties() { Contact contact; contact = new Contact(); Dictionary <string, string> properties = new Dictionary <string, string>(); properties.Add("Uid", contact.GenerateUid()); properties.Add("GivenName", "John"); properties.Add("FamilyName", "Smith"); properties.Add("Birthdate", "3.12.2001"); properties.Add("Gender", "1"); properties.Add("WeightKg", "70.3"); properties.Add("HeightCm", "186"); properties.Add("Zip", "123"); properties.Add("Country", "Schweiz"); properties.Add("Address", "Internetstrasse 42"); properties.Add("Phone", "+00 123 456 789 0"); properties.Add("Email", "*****@*****.**"); foreach (KeyValuePair <string, string> entry in properties) { contact[entry.Key] = (string)entry.Value; } var presenter = new ContactJSONPresenter(contact); string resultJSON = Serializer.Serialize(presenter); foreach (KeyValuePair <string, string> entry in properties) { Assert.IsTrue(resultJSON.Contains(entry.Value)); } }
public void Test_ContactJSONPresenter_Serializability() { Contact contact; contact = new Contact(); var presenter = new ContactJSONPresenter(contact); var expected = ExpectedJSONWithObject(contact); string resultJSON = Serializer.Serialize(presenter); Assert.AreEqual(expected, resultJSON); Assert.IsTrue(Serializer.Deserialize <Contact>(resultJSON) is Contact); }