Пример #1
0
 public void TestWithExcluded()
 {
     var entity = CreatEntity();
     var obj = new ReflectionEntityConstructor().ConstructObject<TestModel>(entity);
     obj.Name = "nadia";
     TestUtils.AssertEqual(obj, entity, new[] { "name" });
 }
Пример #2
0
 public void TestNoException()
 {
     var entity = CreatEntity();
     var constructor = new ReflectionEntityConstructor();
     var obj = constructor.ConstructObject<TestModel>(entity);
     TestUtils.AssertEqual(obj, entity);
 }
Пример #3
0
        public void TestWithException()
        {
            var entity = CreatEntity();
            var constructor = new ReflectionEntityConstructor();
            var obj = constructor.ConstructObject<TestModel>(entity);
            obj.Name = "exg;lksrg";
            Exception ex = Assert.Throws<AssertException>(() => { TestUtils.AssertEqual(obj, entity); });

            Assert.Equal(
                $"Assertion failed. Property Name = {obj.Name}. Entity name = {entity["name"]}",
                ex.Message
                );
        }