Пример #1
0
        public void TestConvertFromDataWithMapperDynamic()
        {
            var vm = new FakeVM();

            vm = Mapper.Map(_data, vm);
            FromDataAssert(vm);
        }
Пример #2
0
        public void TestConvertFromDataWithMapperStatic()
        {
            var vm = new FakeVM();

            vm = Mapper.FromEntity(vm, _data);
            FromDataAssert(vm);
        }
Пример #3
0
        public void TestConvertFromDataAsBase()
        {
            var vm = new FakeVM();

            vm.AutoMapFrom(_data);
            FromDataAssert(vm);
        }
Пример #4
0
 private void FromDataAssert(FakeVM vm)
 {
     Assert.AreEqual(vm.Name, _data.Name);
     Assert.AreEqual(vm.IsDeleted, _data.IsDeleted);
     Assert.AreEqual(vm.CreatedDate, _data.CreatedDate);
     Assert.AreEqual(vm.ID, _data.ID);
     Assert.AreEqual(vm.ReferenceID, _data.RefID);
     Assert.AreEqual(vm.CurrentDate, _data.CurrentDate);
     Assert.AreEqual(vm.RefItemName, _data.Item.Name);
     Assert.AreEqual(vm.Child.Name, _data.OneChild.Name);
 }
Пример #5
0
        public void Init()
        {
            _data = new FakeDataEntity
            {
                CreatedDate      = DateTime.Today,
                CreatedBy        = "testuser",
                LastModifiedDate = DateTime.Today,
                LastModifiedBy   = "testuser",
                CurrentDate      = DateTime.Now,
                ID        = 10,
                IsDeleted = true,
                Name      = "Fake Entity",
                RefID     = 111,
                Item      = new RefItem {
                    Name = "Item Ref"
                },
                OneChild = new Child {
                    Name = "Item Child"
                }
            };

            _vm = new FakeVM
            {
                CreatedDate      = DateTime.Today,
                CreatedBy        = "testuser",
                LastModifiedDate = DateTime.Today,
                LastModifiedBy   = "testuser",
                CurrentDate      = DateTime.Now,
                ID          = 10,
                IsDeleted   = true,
                Name        = "Fake Entity",
                ReferenceID = 111,
                Children    = new List <string> {
                    "Test1", "Test2"
                },
            };
        }