Beispiel #1
0
        public void AdditionDifferentProps()
        {
            var obj = new TestClass();

            Assert.AreEqual($"{{\"{nameof(obj.NumProp)}, {nameof(obj.NumProp2)}\":{obj.NumProp + obj.NumProp2}}}",
                            Morpher.Describe(obj,
                                             o => o.NumProp + o.NumProp2
                                             ));
        }
Beispiel #2
0
        public void TwoProperties()
        {
            var obj = new TestClass();

            Assert.AreEqual($"{{\"{nameof(obj.NumProp)}\":{obj.NumProp},\"{nameof(obj.NumProp2)}\":{obj.NumProp2}}}",
                            Morpher.Describe(obj,
                                             o => o.NumProp,
                                             o => o.NumProp2
                                             ));
        }
Beispiel #3
0
        public void ObjectMethodWithDifferentObjectParam()
        {
            var obj  = new TestClass();
            var obj2 = new TestClass();

            Assert.AreEqual($"{{\"{nameof(obj.MethodWithParam)}()\":\"{obj.MethodWithParam(obj2.NumProp.ToString())}\"}}",
                            Morpher.Describe(obj,
                                             o => o.MethodWithParam(obj2.NumProp.ToString())
                                             ));
        }
Beispiel #4
0
        public void ObjectProperty()
        {
            var obj  = new TestClass();
            var obj2 = new SecondTestClass();

            obj.ObjProp = obj2;
            Assert.AreEqual($"{{\"{nameof(obj.ObjProp)}\":{{\"{nameof(obj2.SecNumProp)}\":{obj2.SecNumProp}}}}}",
                            Morpher.Describe(obj,
                                             o => Morpher.Morph(o.ObjProp,
                                                                o2 => o2.SecNumProp
                                                                )
                                             ));
        }
Beispiel #5
0
        public void MethodWithParam()
        {
            var obj = new TestClass();

            Assert.AreEqual($"{{\"{nameof(obj.MethodWithParam)}()\":\"{obj.MethodWithParam("foo")}\"}}", Morpher.Describe(obj,
                                                                                                                          o => o.MethodWithParam("foo")
                                                                                                                          ));
        }
Beispiel #6
0
        public void Method()
        {
            var obj = new TestClass();

            Assert.AreEqual($"{{\"{nameof(obj.MyMethod)}()\":\"{obj.MyMethod()}\"}}", Morpher.Describe(obj,
                                                                                                       o => o.MyMethod()
                                                                                                       ));
        }