public void SerializeObjectFromForm_CompletedForm_FullyInitializedObject() { frindle dummy = new frindle(); frindle dumber = new frindle(); TestFormField fieldOne = new TestFormField("Name", "Name:", "Enter a name."); TestFormField fieldTwo = new TestFormField("Whut", "Whut?:", "Enter schtuff."); FormViewModel form = new FormViewModel(); fieldOne.Content = dummy.Name = "Waldo"; fieldTwo.Content = dummy.Whut = "Navy SEAL"; form.AddField(fieldOne); form.AddField(fieldTwo); dumber = form.SerializeObjectFromForm(typeof(frindle)) as frindle; Assert.AreEqual(dummy.Name, dumber.Name); Assert.AreEqual(dummy.Whut, dumber.Whut); }
public void SerializeObjectFromForm_Null_ExceptionThrown() { frindle dummy; FormViewModel form = new FormViewModel(); form.AddField(new TestFormField("Name", "Name:", "Enter a name.")); form.AddField(new TestFormField("Whut", "Whut?:", "Enter schtuff.")); dummy = form.SerializeObjectFromForm(null) as frindle; }
public void SerializeObjectFromForm_PartialForm_PartialObject() { frindle dummy = new frindle(); TestFormField field = new TestFormField("Name", "Name:", "Enter a name."); FormViewModel form = new FormViewModel(); field.Content = dummy.Name = "Waldo"; form.AddField(field); Assert.AreEqual(dummy.Name, (form.SerializeObjectFromForm(typeof(frindle)) as frindle).Name); }
public void SerializeObjectFromForm_EmptyForm_EmptyObject() { frindle dummy = new frindle(); frindle dumber = new frindle(); FormViewModel form = new FormViewModel(); dumber = form.SerializeObjectFromForm(typeof(frindle)) as frindle; Assert.IsNull(dumber.Name); }