public void Named_property_is_mapped() { const string expected = "name"; var classOne = new ClassOne { NamedProperty = expected }; var classTwo = classOne.MapAs<ClassTwo>(); classTwo.NamedProperty.ShouldEqual(expected); }
public void Date_time_property_is_mapped() { var expected = new DateTime(1979, 6, 15); var classOne = new ClassOne { DateTimeProperty = expected }; var classTwo = classOne.MapAs<ClassTwo>(); classTwo.DateTimeProperty.ShouldEqual(expected); }
public void Int_property_is_mapped() { const int expected = 7; var classOne = new ClassOne { IntProperty = expected }; var classTwo = classOne.MapAs<ClassTwo>(); classTwo.IntProperty.ShouldEqual(expected); }
public void Bool_property_is_mapped() { const bool expected = true; var classOne = new ClassOne { BoolProperty = expected }; var classTwo = classOne.MapAs<ClassTwo>(); classTwo.BoolProperty.ShouldEqual(expected); }
public void String_property_is_mapped() { const string expected = "string"; var classOne = new ClassOne { StringProperty = expected }; var classTwo = classOne.MapAs<ClassTwo>(); classTwo.StringProperty.ShouldEqual(expected); }
public void Returns_the_correct_type() { var classOne = new ClassOne(); var classTwo = classOne.MapAs<ClassTwo>(); classTwo.ShouldBeType<ClassTwo>(); }
public void Conversion_of_uri_to_string_works() { var classOne = new ClassOne { UriToStringTypeProperty = new Uri("http://jaredmcguire.com/") }; var classTwo = classOne.MapAs<ClassTwo>(); classTwo.UriToStringTypeProperty.ShouldEqual("http://jaredmcguire.com/"); }
public void Conversion_of_unknown_object_to_string_gives_object_type_as_a_string() { var classOne = new ClassOne { ObjectToStringProperty = new Object() }; var classTwo = classOne.MapAs<ClassTwo>(); classTwo.ObjectToStringProperty.ShouldEqual("System.Object"); }
public void Conversion_of_int_to_string_works() { var classOne = new ClassOne { IntToStringTypeProperty = 123 }; var classTwo = classOne.MapAs<ClassTwo>(); classTwo.IntToStringTypeProperty.ShouldEqual("123"); }
public void Conversion_of_datetime_to_string_works() { var classOne = new ClassOne { DateTimeToStringTypeProperty = new DateTime(1979, 6, 15) }; var classTwo = classOne.MapAs<ClassTwo>(); classTwo.DateTimeToStringTypeProperty.ShouldEqual("6/15/1979 12:00:00 AM"); }
public void Types_that_cannot_convert_are_ignored() { var classOne = new ClassOne { EventArgsToUriFailProperty = new EventArgs() }; var classTwo = classOne.MapAs<ClassTwo>(); classTwo.EventArgsToUriFailProperty.ShouldBeNull(); }
public void The_cache_increases_by_two_after_the_first_mapping() { var classOne = new ClassOne(); var classTwo = classOne.MapAs<ClassTwo>(); Map.Cache.Count.ShouldEqual(2); }
public void The_cache_increases_by_one_after_mapping_with_an_unknow_type() { var classOneA = new ClassOne(); var classTwoA = classOneA.MapAs<ClassTwo>(); Map.Cache.Count.ShouldEqual(2); var classOneB = new ClassOne(); var classThree = classOneB.MapAs<ClassThree>(); Map.Cache.Count.ShouldEqual(3); }
public void The_cache_does_not_increases_after_mapping_with_know_types() { var classOneA = new ClassOne(); var classTwoA = classOneA.MapAs<ClassTwo>(); Map.Cache.Count.ShouldEqual(2); var classOneB = new ClassOne(); var classTwoB = classOneB.MapAs<ClassTwo>(); Map.Cache.Count.ShouldEqual(2); }