示例#1
0
        public void SimplePropertyMappingUpdate()
        {
            var entity = new SimpleEntity { Id = 1, Name = "Awesome name", Birthday = new DateTime(2000, 01, 02) };
            var viewmodel = new SimpleViewModel
                { Name = "Awefull name", Birthday = new DateTime(2001, 02, 03), Wedding = new DateTime(2010, 03, 04) };

            viewmodel.Update(entity);

            entity.Id.Should().Be(1);
            entity.Name.Should().Be("Awefull name");
            entity.Birthday.Should().Be(new DateTime(2001, 02, 03));
            entity.Marrige.Should().Be(new DateTime(2010, 03, 04));
        }
示例#2
0
        public void SimplePropertyMappingFill()
        {
            var entity = new SimpleEntity
                { Name = "Awesome name", Birthday = new DateTime(2000, 01, 02), Marrige = new DateTime(2010, 02, 03) };
            var viewmodel = new SimpleViewModel();

            viewmodel.Fill(entity);

            viewmodel.Comment.Should().BeNullOrEmpty();
            viewmodel.Wedding.Should().Be(new DateTime(2010, 02, 03));
            viewmodel.Name.Should().Be("Awesome name");
            viewmodel.Birthday.Should().Be(new DateTime(2000, 01, 02));
        }