コード例 #1
0
 public void Mapper_has_not_been_registered_should_throw_mapper_not_registered_exception()
 {
     IosContactName iosContactName = new IosContactName();
      var wcfContactName = new WcfContactName()
                       {
                          Login = "******",
                          FirstName = "Nick",
                          LastName = "Perry",
                          Age = 22,
                          Address = new Address() {City = "London", Street = "Golden Lane"}
                       };
      Mapper mapper = new Mapper();
      mapper.ApplyMapping(wcfContactName, iosContactName);
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: alexaFemida/AutoMapper
 static void Main(string[] args)
 {
     IosContactName iosContactName = new IosContactName();
      var wcfContactName = new WcfContactName()
      {
     Login = "******",
     FirstName = "Nick",
     LastName = "Perry",
     Age = 22,
     Address = new Address() { City = "London", Street = "Golden Lane" }
      };
      Mapper mapper = new Mapper();
      mapper.MapTypes<WcfContactName, IosContactName>();
      mapper.ApplyMapping(wcfContactName, iosContactName);
 }
コード例 #3
0
 public void Should_ignore_property_where_name_matches_but_different_type()
 {
     IosContactName iosContactName = new IosContactName();
      var wcfContactName = new WcfContactName()
                       {
                          Login = "******",
                          FirstName = "Nick",
                          LastName = "Perry",
                          Age = 22,
                          Address = new Address() {City = "London", Street = "Golden Lane"}
                       };
      Mapper mapper = new Mapper();
      mapper.MapTypes<WcfContactName, IosContactName>();
      mapper.ApplyMapping(wcfContactName, iosContactName);
      Assert.AreEqual(null, iosContactName.Age);
 }
コード例 #4
0
        public void Should_set_values_where_name_matches_and_same_type_in_inner_class()
        {
            IosContactName iosContactName = new IosContactName();
             var wcfContactName = new WcfContactName()
                              {
                                 Login = "******",
                                 FirstName = "Nick",
                                 LastName = "Perry",
                                 Age = 22,
                                 Address = new Address() {City = "London", Street = "Golden Lane"}
                              };
             Mapper mapper = new Mapper();
             mapper.MapTypes<WcfContactName, IosContactName>();
             mapper.ApplyMapping(wcfContactName, iosContactName);

             Assert.AreEqual(wcfContactName.Address.City, "London");
        }