Esempio n. 1
0
        public void PrintToString_ReturnStringWithoutExcludedType_WhenTypeExcluded()
        {
            var testClass = new TestClassExcludedString();
            var printer   = ObjectPrinter.For <TestClassExcludedString>()
                            .Excluding <string>()
                            .Excluding <double>();


            string s1 = printer.PrintToString(testClass);

            Console.WriteLine("|" + s1 + "|");

            s1.Should().BeEquivalentTo("TestClassExcludedString" + Environment.NewLine);
        }
Esempio n. 2
0
        public void PrintToString_ReturnCurrentString_WhenStringTrim()
        {
            var testClass = new TestClassExcludedString();

            testClass.TestText = "Text";
            var printer = ObjectPrinter.For <TestClassExcludedString>()
                          .Printing(x => x.TestText).TrimmedToLength(2);


            string s1 = printer.PrintToString(testClass);

            Console.WriteLine("|" + s1 + "|");

            s1.Should().BeEquivalentTo("TestClassExcludedString"
                                       + Environment.NewLine
                                       + "\t" + " TestText = Te"
                                       + Environment.NewLine);
        }
Esempio n. 3
0
        public void PrintToString_ReturnCurrentString_WhenUsingAlternativeSerializationForProperty()
        {
            var testClass = new TestClassExcludedString();

            testClass.TestText = "Text";
            var printer = ObjectPrinter.For <TestClassExcludedString>()
                          .Printing(x => x.TestText).Using(s => s + " + AltSerializeProperty(str)");


            string s1 = printer.PrintToString(testClass);

            Console.WriteLine("|" + s1 + "|");

            s1.Should().BeEquivalentTo("TestClassExcludedString"
                                       + Environment.NewLine
                                       + "\t" + " TestText = Text + AltSerializeProperty(str)"
                                       + Environment.NewLine);
        }