public static void AssertIsEqual(ModelWithFieldsOfDifferentTypes actual, ModelWithFieldsOfDifferentTypesAsNullables expected)
 {
     Assert.That(actual.Id, Is.EqualTo(expected.Id.Value));
     Assert.That(actual.Name, Is.EqualTo(expected.Name));
     Assert.That(actual.Guid, Is.EqualTo(expected.Guid.Value));
     Assert.That(actual.LongId, Is.EqualTo(expected.LongId.Value));
     Assert.That(actual.Bool, Is.EqualTo(expected.Bool.Value));
     try
     {
         Assert.That(actual.DateTime, Is.EqualTo(expected.DateTime.Value));
     }
     catch (Exception ex)
     {
         Log.Error("Trouble with DateTime precisions, trying Assert again with rounding to seconds", ex);
         Assert.That(actual.DateTime.RoundToSecond(), Is.EqualTo(expected.DateTime.Value.RoundToSecond()));
     }
     try
     {
         Assert.That(actual.Double, Is.EqualTo(expected.Double.Value));
     }
     catch (Exception ex)
     {
         Log.Error("Trouble with double precisions, trying Assert again with rounding to 10 decimals", ex);
         Assert.That(Math.Round(actual.Double, 10), Is.EqualTo(Math.Round(actual.Double, 10)));
     }
 }
		public void Can_serialize_ModelWithFieldsOfDifferentTypes_to_StringDictionary()
		{
			var model = new ModelWithFieldsOfDifferentTypes
				{
					Id = 1,
					Name = "Name1",
					LongId = 1000,
					Guid = new Guid("{7da74353-a40c-468e-93aa-7ff51f4f0e84}"),
					Bool = false,
					DateTime = new DateTime(2010, 12, 20),
					Double = 2.11d,
				};

			Console.WriteLine(model.Dump());
			/* Prints out:
				{
					Id: 1,
					Name: Name1,
					LongId: 1000,
					Guid: 7da74353a40c468e93aa7ff51f4f0e84,
					Bool: False,
					DateTime: 2010-12-20,
					Double: 2.11
				}
			 */

			Dictionary<string, string> map = model.ToStringDictionary();
			Assert.That(map.EquivalentTo(
				new Dictionary<string, string>
				{
					{"Id","1"},
					{"Name","Name1"},
					{"LongId","1000"},
					{"Guid","7da74353a40c468e93aa7ff51f4f0e84"},
					{"Bool","False"},
					{"DateTime","2010-12-20"},
					{"Double","2.11"},
				}));
		}
        public static ModelWithFieldsOfDifferentTypes CreateConstant(int id)
        {
            var row = new ModelWithFieldsOfDifferentTypes
            {
                Id = id,
                Bool = id % 2 == 0,
                DateTime = new DateTime(1979, (id % 12) + 1, (id % 28) + 1),
                Double = 1.11d + id,
                Guid = new Guid(((id % 240) + 16).ToString("X") + "726E3B-9983-40B4-A8CB-2F8ADA8C8760"),
                LongId = 999 + id,
                Name = "Name" + id
            };

            return row;
        }
        public static ModelWithFieldsOfDifferentTypes Create(int id)
        {
            var row = new ModelWithFieldsOfDifferentTypes
            {
                Id = id,
                Bool = id % 2 == 0,
                DateTime = DateTime.Now.AddDays(id),
                Double = 1.11d + id,
                Guid = Guid.NewGuid(),
                LongId = 999 + id,
                Name = "Name" + id
            };

            return row;
        }