public void Nullable_bool_property_is_mapped() { const bool expected = true; var classOne = new InClass(string.Empty) { NullableBoolProperty = expected }; var classTwo = classOne.MapAs<OutClass>(); classTwo.NullableBoolProperty.ShouldEqual(expected); }
public void Guid_property_is_mapped() { var expected = Guid.NewGuid(); var classOne = new InClass(string.Empty) { GuidProperty = expected }; var classTwo = classOne.MapAs<OutClass>(); classTwo.GuidProperty.ShouldEqual(expected); }
public void String_property_is_mapped() { const string expected = "string"; var classOne = new InClass(string.Empty) { StringProperty = expected }; var classTwo = classOne.MapAs<OutClass>(); classTwo.StringProperty.ShouldEqual(expected); }
public void Nullable_int_property_is_mapped() { const int expected = 7; var classOne = new InClass(string.Empty) { NullableIntProperty = expected }; var classTwo = classOne.MapAs<OutClass>(); classTwo.NullableIntProperty.ShouldEqual(expected); }
public void Named_property_is_mapped() { const string expected = "name"; var classOne = new InClass(string.Empty) { NamedProperty = expected }; var classTwo = classOne.MapAs<OutClass>(); classTwo.NamedProperty.ShouldEqual(expected); }
public void Conversion_of_int_to_string_works() { var classOne = new InClass(string.Empty) { IntToStringTypeProperty = 123 }; var classTwo = classOne.MapAs<OutClass>(); classTwo.IntToStringTypeProperty.ShouldEqual("123"); }
public void Date_time_property_is_mapped() { var expected = new DateTime(1979, 6, 15); var classOne = new InClass(string.Empty) { DateTimeProperty = expected }; var classTwo = classOne.MapAs<OutClass>(); classTwo.DateTimeProperty.ShouldEqual(expected); }
public void Non_matching_derived_property_is_mapped_using_strings() { Survey.DefineMap<InClass, OutClass>("ClassOneOnlyDerivedProperty", "ClassTwoOnlyDerivedProperty"); var classOne = new InClass(string.Empty) { ClassOneOnlyDerivedProperty = "foo" }; var classTwo = classOne.MapAs<OutClass>(); classTwo.ClassTwoOnlyDerivedProperty.ShouldEqual("foo"); }
public void Derived_property_is_mapped() { var classOne = new InClass(string.Empty) { DerivedProperty = "foo" }; var classTwo = classOne.MapAs<OutClass>(); classTwo.DerivedProperty.ShouldEqual("foo"); }
public void Returns_the_correct_type() { var classOne = new InClass(string.Empty); var classTwo = classOne.MapAs<OutClass>(); classTwo.ShouldBeType<OutClass>(); }
public void Non_matching_fields_with_a_defined_map_are_mapped() { Survey.DefineMap<InClass, OutClass>(inClass => inClass.ClassOneOnlyProperty, outClass => outClass.ClassTwoOnlyProperty); var classOne = new InClass(string.Empty) { ClassOneOnlyProperty = "foo" }; var classTwo = classOne.MapAs<OutClass>(); classTwo.ClassTwoOnlyProperty.ShouldEqual("foo"); }
public void Types_that_cannot_convert_are_ignored() { var classOne = new InClass(string.Empty) { EventArgsToUriFailProperty = new EventArgs() }; var classTwo = classOne.MapAs<OutClass>(); classTwo.EventArgsToUriFailProperty.ShouldBeNull(); }
public void Conversion_of_unknown_object_to_string_gives_object_type_as_a_string() { var classOne = new InClass(string.Empty) { ObjectToStringProperty = new Object() }; var classTwo = classOne.MapAs<OutClass>(); classTwo.ObjectToStringProperty.ShouldEqual("System.Object"); }
public void Conversion_of_uri_to_string_works() { var classOne = new InClass(string.Empty) { UriToStringTypeProperty = new Uri("http://jaredmcguire.com/") }; var classTwo = classOne.MapAs<OutClass>(); classTwo.UriToStringTypeProperty.ShouldEqual("http://jaredmcguire.com/"); }
public void Conversion_of_datetime_to_string_works() { var classOne = new InClass(string.Empty) { DateTimeToStringTypeProperty = new DateTime(1979, 6, 15) }; var classTwo = classOne.MapAs<OutClass>(); classTwo.DateTimeToStringTypeProperty.ShouldEqual("6/15/1979 12:00:00 AM"); }