public void ExtractStringOrValueTypeElements_SuccessResult() { // Creating the xml string xml = @"<test> <int>10</int> <string>test</string> <char>c</char> <date>10/10/2015</date> <double>123.5</double> <float>123.4</float> <bool>true</bool> </test>"; // Creating the model var model = new StringOrValueTypesTestModel(); // Extracting Contents model.Extract(xml); // Checking Result Assert.AreEqual(model.Int, 10); Assert.AreEqual(model.String, "test"); Assert.AreEqual(model.Char, 'c'); Assert.AreEqual(model.Date, new DateTime(2015, 10, 10)); Assert.AreEqual(model.Double, (double)123.5); Assert.AreEqual(model.Float, (float)123.4); Assert.AreEqual(model.Bool, true); }
public void ExtractStringOrValueTypeProperty_SuccessResult() { // Creating the xml string xml = @"<test int='10' string='test' char='c' date='10/10/2015' double='123.5' float='123.4' bool='true' ></test>"; // Creating the model var model = new StringOrValueTypesTestModel(); // Extracting Contents model.Extract(xml); // Checking Result Assert.AreEqual(model.Int, 10); Assert.AreEqual(model.String, "test"); Assert.AreEqual(model.Char, 'c'); Assert.AreEqual(model.Date, new DateTime(2015, 10, 10)); Assert.AreEqual(model.Double, (double)123.5); Assert.AreEqual(model.Float, (float)123.4); Assert.AreEqual(model.Bool, true); }
public void ExtractStringOrValueTypeValue_GetDefaultValueIfNoValuePresent() { // Creating the xml string xml = @"<test> <int></int> <string></string> <char></char> <date></date> <double></double> <float></float> <bool></bool> </test>"; // Creating the model var model = new StringOrValueTypesTestModel(); // Extracting Contents model.Extract(xml); // Checking Result Assert.AreEqual(model.Int.Value, default(int)); Assert.AreEqual(model.String.Value, default(string)); Assert.AreEqual(model.Char.Value, default(char)); Assert.AreEqual(model.Date.Value, default(DateTime)); Assert.AreEqual(model.Double.Value, default(double)); Assert.AreEqual(model.Float.Value, default(float)); Assert.AreEqual(model.Bool.Value, default(bool)); }
public void ExtractStringOrValueTypeProperty_GetDefaultValueIfNoValuePresent() { // Creating the xml string xml = @"<test></test>"; // Creating the model var model = new StringOrValueTypesTestModel(); // Extracting Contents model.Extract(xml); // Checking Result Assert.AreEqual(model.Int, default(int)); Assert.AreEqual(model.String, default(string)); Assert.AreEqual(model.Char, default(char)); Assert.AreEqual(model.Date, default(DateTime)); Assert.AreEqual(model.Double, default(double)); Assert.AreEqual(model.Float, default(float)); Assert.AreEqual(model.Bool, default(bool)); }
public void ExtractStringOrValueTypeValue_SuccessResult() { // Creating the xml string xml = @"<test> <int>10</int> <string>test</string> <char>c</char> <date>10/10/2015</date> <double>123.5</double> <float>123.4</float> <bool>true</bool> </test>"; // Creating the model var model = new StringOrValueTypesTestModel(); // Extracting Contents model.Extract(xml); // Checking Result Assert.AreEqual(model.Int.Value, 10); Assert.AreEqual(model.String.Value, "test"); Assert.AreEqual(model.Char.Value, 'c'); Assert.AreEqual(model.Date.Value, new DateTime(2015, 10, 10)); Assert.AreEqual(model.Double.Value, (double)123.5); Assert.AreEqual(model.Float.Value, (float)123.4); Assert.AreEqual(model.Bool.Value, true); }