예제 #1
0
        public void WriteToBareBones()
        {
            ExceptionData data = new ExceptionData("type", "message", "stacktrace", ExceptionData.NoProperties, null);
            StringMarkupDocumentWriter writer = new StringMarkupDocumentWriter(true);

            data.WriteTo(writer.Failures);

            Assert.AreEqual("[Marker \'Exception\'][Marker \'ExceptionType\']type[End]: [Marker \'ExceptionMessage\']message[End]\n[Marker \'StackTrace\']stacktrace[End][End]",
                            writer.ToString());
        }
예제 #2
0
        public void WriteToEverything(bool useStandardFormatting)
        {
            ExceptionData innerData = new ExceptionData("type", "message", "stacktrace", ExceptionData.NoProperties, null);
            ExceptionData outerData = new ExceptionData("type", "message", "stacktrace",
                                                        new PropertySet()
            {
                { "Prop1", "Value1" },
                { "Prop2", "Value2" }
            }, innerData);

            StringMarkupDocumentWriter writer = new StringMarkupDocumentWriter(true);

            outerData.WriteTo(writer.Failures, useStandardFormatting);

            Assert.AreEqual("[Marker \'Exception\'][Marker \'ExceptionType\']type[End]: [Marker \'ExceptionMessage\']message[End] ---> [Marker \'Exception\'][Marker \'ExceptionType\']type[End]: [Marker \'ExceptionMessage\']message[End]\n"
                            + "[Marker \'StackTrace\']stacktrace[End][End]\n   --- End of inner exception stack trace ---\n"
                            + (useStandardFormatting ? "" : "[Marker \'ExceptionPropertyName\']Prop1[End]: [Marker \'ExceptionPropertyValue\']Value1[End]\n[Marker \'ExceptionPropertyName\']Prop2[End]: [Marker \'ExceptionPropertyValue\']Value2[End]\n")
                            + "[Marker \'StackTrace\']stacktrace[End][End]",
                            writer.ToString());
        }
예제 #3
0
        public void WriteToThrowsIfArgumentIsNull()
        {
            ExceptionData data = new ExceptionData("type", "message", "stacktrace", ExceptionData.NoProperties, null);

            Assert.Throws <ArgumentNullException>(() => data.WriteTo(null));
        }
예제 #4
0
        public void WriteToEverything(bool useStandardFormatting)
        {
            ExceptionData innerData = new ExceptionData("type", "message", "stacktrace", ExceptionData.NoProperties, null);
            ExceptionData outerData = new ExceptionData("type", "message", "stacktrace",
                new PropertySet() {
                    { "Prop1", "Value1" },
                    { "Prop2", "Value2" }
                }, innerData);

            StringMarkupDocumentWriter writer = new StringMarkupDocumentWriter(true);
            outerData.WriteTo(writer.Failures, useStandardFormatting);

            Assert.AreEqual("[Marker \'Exception\'][Marker \'ExceptionType\']type[End]: [Marker \'ExceptionMessage\']message[End] ---> [Marker \'Exception\'][Marker \'ExceptionType\']type[End]: [Marker \'ExceptionMessage\']message[End]\n"
                + "[Marker \'StackTrace\']stacktrace[End][End]\n   --- End of inner exception stack trace ---\n"
                + (useStandardFormatting ? "" : "[Marker \'ExceptionPropertyName\']Prop1[End]: [Marker \'ExceptionPropertyValue\']Value1[End]\n[Marker \'ExceptionPropertyName\']Prop2[End]: [Marker \'ExceptionPropertyValue\']Value2[End]\n")
                + "[Marker \'StackTrace\']stacktrace[End][End]",
                writer.ToString());
        }
예제 #5
0
        public void WriteToBareBones()
        {
            ExceptionData data = new ExceptionData("type", "message", "stacktrace", ExceptionData.NoProperties, null);
            StringMarkupDocumentWriter writer = new StringMarkupDocumentWriter(true);
            data.WriteTo(writer.Failures);

            Assert.AreEqual("[Marker \'Exception\'][Marker \'ExceptionType\']type[End]: [Marker \'ExceptionMessage\']message[End]\n[Marker \'StackTrace\']stacktrace[End][End]",
                writer.ToString());
        }
예제 #6
0
 public void WriteToThrowsIfArgumentIsNull()
 {
     ExceptionData data = new ExceptionData("type", "message", "stacktrace", ExceptionData.NoProperties, null);
     Assert.Throws<ArgumentNullException>(() => data.WriteTo(null));
 }