Exemple #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
                                             ));
        }
Exemple #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
                                             ));
        }
Exemple #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())
                                             ));
        }
Exemple #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
                                                                )
                                             ));
        }
Exemple #5
0
        public void MethodWithParam()
        {
            var obj = new TestClass();

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

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