public void LoggingToolkit_MethodArguments_LogsMethodArgumentNames()
        {
            SimpleClass s = new SimpleClass();
            s.MethodWith2Arguments(stringArg: "TEST", intArg: 12345);

            string output = OutputString.ToString();
            StringAssert.Contains("MethodWith2Arguments(string stringArg = \"TEST\", int intArg = 12345)", output);
        }
        public void LoggingToolkit_SimpleClassWithFields_LoggingNotAppliedToField()
        {
            SimpleClass s = new SimpleClass();
            s.Field1 = "Test";

            string output = OutputString.ToString();
            StringAssert.DoesNotContain("Field1", output);
        }
        public void Log4Net_Methods_LogsMethodEnter()
        {
            SimpleClass s = new SimpleClass();
            s.Method1();

            string output = OutputString.ToString();
            StringAssert.Contains("DEBUG TestAssembly.SimpleClass (null) - Entering: TestAssembly.SimpleClass.Method1()", output);
        }
Example #4
0
        public void Trace_Methods_LogsMethodEnter()
        {
            SimpleClass s = new SimpleClass();
            s.Method1();

            string output = OutputString.ToString();
            StringAssert.Contains("Entering: TestAssembly.SimpleClass.Method1()", output);
        }
        public void Log4Net_Properties_LogsPropertySetter()
        {
            SimpleClass s = new SimpleClass();
            s.Property1 = "Test";

            string output = OutputString.ToString();
            StringAssert.Contains("DEBUG TestAssembly.SimpleClass (null) - Entering: TestAssembly.SimpleClass.set_Property1(string value = \"Test\")", output);
        }
        public void MethodArguments_MethodWith3Arguments_LogsArgument()
        {
            SimpleClass s = new SimpleClass();
            s.MethodWith3Arguments("Test", 42, 128.5);

            string output = OutputString.ToString();
            StringAssert.Contains("TestAssembly.SimpleClass.MethodWith3Arguments(System.String stringArg = \"Test\", System.Int32 intArg = 42, System.Double doubleArg = 128.5)", output);
        }
        public void MethodArguments_MethodWith1Argument_LogsArgument()
        {
            SimpleClass s = new SimpleClass();
            s.MethodWith1Argument("Test");

            string output = OutputString.ToString();
            StringAssert.Contains("TestAssembly.SimpleClass.MethodWith1Argument(System.String stringArg = \"Test\")", output);
        }
        public void MethodArguments_MethodWith2Arguments_LogsArgument()
        {
            SimpleClass s = new SimpleClass();
            s.MethodWith2Arguments("Test", 42);

            string output = OutputString.ToString();
            StringAssert.Contains("TestAssembly.SimpleClass.MethodWith2Arguments(string stringArg = \"Test\", int intArg = 42)", output);
        }
Example #9
0
        public void Trace_Properties_LogsPropertyGetter()
        {
            SimpleClass s = new SimpleClass();
            string value = s.Property1;

            string output = OutputString.ToString();
            StringAssert.Contains("Entering: TestAssembly.SimpleClass.get_Property1()", output);
        }
        public void LoggingToolkit_StringArgumentIsNull_PrintsEmptyString()
        {
            SimpleClass s = new SimpleClass();
            s.MethodWith1Argument(null);

            string output = OutputString.ToString();
            StringAssert.Contains("MethodWith1Argument(string stringArg = \"\")", output);
        }
Example #11
0
        public void Trace_Properties_LogsPropertySetter()
        {
            SimpleClass s = new SimpleClass();
            s.Property1 = "Test";

            string output = OutputString.ToString();
            StringAssert.Contains("Entering: TestAssembly.SimpleClass.set_Property1(System.String value = \"Test\")", output);
        }
        public void MethodArguments_MethodWith4Arguments_LogsArgument()
        {
            SimpleClass s = new SimpleClass();
            s.MethodWith4Arguments("arg0", "arg1", "arg2", "arg3");

            string output = OutputString.ToString();
            StringAssert.Contains("TestAssembly.SimpleClass.MethodWith4Arguments(System.String arg0 = \"arg0\", " +
                "System.String arg1 = \"arg1\", System.String arg2 = \"arg2\", System.String arg3 = \"arg3\")", output);
        }
        public void MethodArguments_MethodWithOutArguments_LogsArguments()
        {
            SimpleClass s = new SimpleClass();
            int x = 1;
            SimpleClass sc;
            s.MethodWithOutArguments(out x, out sc);

            string output = OutputString.ToString();
            StringAssert.Contains("TestAssembly.SimpleClass.MethodWithOutArguments(out int arg0, out TestAssembly.SimpleClass arg1)", output);
        }
        public void MethodArguments_MethodWithMixedArguments_LogsArguments()
        {
            SimpleClass s = new SimpleClass();
            int x;
            SimpleClass sc = null;
            s.MethodWithMixedArguments(5, out x, ref sc, "test");

            string output = OutputString.ToString();
            StringAssert.Contains("TestAssembly.SimpleClass.MethodWithMixedArguments(int arg0 = 5, out int arg1, ref TestAssembly.SimpleClass arg2 = {}, string arg3 = \"test\")", output);
        }
Example #15
0
        public void Trace_OnException_PrintsException()
        {
            SimpleClass s = new SimpleClass();
            try
            {
                s.MethodThrowsException();
            }
            catch { }

            string output = OutputString.ToString();
            StringAssert.Contains("System.Exception: This is an exception", output);
        }
        public void Log4Net_OnException_PrintsException()
        {
            SimpleClass s = new SimpleClass();
            try
            {
                s.MethodThrowsException();
            }
            catch { }

            string output = OutputString.ToString();
            StringAssert.Contains("An exception occurred:\nSystem.Exception", output);
        }
Example #17
0
 public void MethodWithMixedArguments(int arg0, out int arg1, ref SimpleClass arg2, string arg3)
 {
     arg1 = 1;
     arg2 = new SimpleClass();
 }
        public void MethodArguments_MethodWithRefArgument_LogsArgument()
        {
            SimpleClass s = new SimpleClass();
            int x = 3;
            s.MethodWithRefArgument( ref x );

            string output = OutputString.ToString();
            StringAssert.Contains("TestAssembly.SimpleClass.MethodWithRefArgument(ref int arg0 = {3})", output);
        }
Example #19
0
 public void MethodWithMixedArguments(int arg0, out int arg1, ref SimpleClass arg2, string arg3)
 {
     arg1 = 1;
     arg2 = new SimpleClass();
 }
Example #20
0
 public void MethodWithOutArguments(out int arg0, out SimpleClass arg1)
 {
     arg0 = 1;
     arg1 = new SimpleClass();
 }
Example #21
0
 public void MethodWithOutArguments(out int arg0, out SimpleClass arg1)
 {
     arg0 = 1;
     arg1 = new SimpleClass();
 }