Ejemplo n.º 1
0
        public void Class()
        {
            var empty       = new EmptyTestClass();
            var emptyActual = empty.Dump();

            Assert.AreEqual("{}", emptyActual);

            var obj1 = new TestClassWithField {
                Key1 = "Value1", Key2 = "Value2", Key3 = "Value3"
            };
            var actual1 = obj1.Dump();

            Assert.AreEqual("{Key1=Value1,Key2=Value2,Key3=Value3}", actual1);

            var obj2    = new TestClassWithField();
            var actual2 = obj2.Dump();

            Assert.AreEqual("{Key1=,Key2=,Key3=}", actual2);

            var obj3 = new TestClassWithProperty {
                Property1 = "Value1", Property2 = "Value2"
            };
            var actual3 = obj3.Dump();

            Assert.AreEqual("{Property1=Value1,Property2=Value2}", actual3);

            var obj4 = new TestClassWithFieldProperty {
                Key1 = "Value1", Property2 = "Value2"
            };
            var actual4 = obj4.Dump();

            Assert.AreEqual("{Key1=Value1,Property2=Value2}", actual4);
        }
Ejemplo n.º 2
0
        public void Class()
        {
            var empty         = new EmptyTestClass();
            var emptyActual   = empty.Apply(self => { });
            var emptyExpected = new EmptyTestClass();

            Assert.AreEqual(emptyExpected.Dump(), emptyActual.Dump());

            var actual = new TestClassWithField().Apply(self =>
            {
                self.Key1 = "Value1";
                self.Key2 = "Value2";
                self.Key3 = "Value3";
            });
            var expected = new TestClassWithField {
                Key1 = "Value1", Key2 = "Value2", Key3 = "Value3"
            };

            Assert.AreEqual(expected.Key1, actual.Key1);
            Assert.AreEqual(expected.Key2, actual.Key2);
            Assert.AreEqual(expected.Key3, actual.Key3);
        }