示例#1
0
文件: MapTests.cs 项目: burkhartt/L2R
 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);
 }
示例#2
0
文件: MapTests.cs 项目: burkhartt/L2R
 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);
 }
示例#3
0
文件: MapTests.cs 项目: burkhartt/L2R
 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);
 }
示例#4
0
文件: MapTests.cs 项目: burkhartt/L2R
 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);
 }
示例#5
0
文件: MapTests.cs 项目: burkhartt/L2R
 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);
 }
示例#6
0
文件: MapTests.cs 项目: burkhartt/L2R
 public void Returns_the_correct_type()
 {
     var classOne = new ClassOne();
     var classTwo = classOne.MapAs<ClassTwo>();
     classTwo.ShouldBeType<ClassTwo>();
 }
示例#7
0
文件: MapTests.cs 项目: burkhartt/L2R
 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/");
 }
示例#8
0
文件: MapTests.cs 项目: burkhartt/L2R
 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");
 }
示例#9
0
文件: MapTests.cs 项目: burkhartt/L2R
 public void Conversion_of_int_to_string_works()
 {
     var classOne = new ClassOne { IntToStringTypeProperty = 123 };
     var classTwo = classOne.MapAs<ClassTwo>();
     classTwo.IntToStringTypeProperty.ShouldEqual("123");
 }
示例#10
0
文件: MapTests.cs 项目: burkhartt/L2R
 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");
 }
示例#11
0
文件: MapTests.cs 项目: burkhartt/L2R
 public void Types_that_cannot_convert_are_ignored()
 {
     var classOne = new ClassOne { EventArgsToUriFailProperty = new EventArgs() };
     var classTwo = classOne.MapAs<ClassTwo>();
     classTwo.EventArgsToUriFailProperty.ShouldBeNull();
 }
示例#12
0
文件: MapTests.cs 项目: burkhartt/L2R
 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);
 }
示例#13
0
文件: MapTests.cs 项目: burkhartt/L2R
        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);
        }
示例#14
0
文件: MapTests.cs 项目: burkhartt/L2R
        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);
        }