Exemple #1
0
        public void from_instance_method_in_derived_class_show_correct_CallingType()
        {
            var entries = new List <LogEntry>();

            using (Log.Events().Subscribe(entries.Add))
            {
                var widget = new InheritedWidget();
                widget.DoStuff();
            }

            Assert.That(entries.Single(e => e.EventType == TraceEventType.Start).CallingType,
                        Is.EqualTo(typeof(InheritedWidget)));

            Assert.That(entries.Single(e => e.EventType == TraceEventType.Stop).CallingType,
                        Is.EqualTo(typeof(InheritedWidget)));
        }
        public void Parameter_logging_can_be_disabled_per_class()
        {
            var log = new StringWriter();

            Extension <Boundaries> .DisableFor <InheritedWidget>();

            using (Log.Events().Subscribe(e => log.Write(e.ToLogString())))
            {
                var w  = new Widget();
                var iw = new InheritedWidget();
                w.DoStuff("should be in log");
                iw.DoStuff("should not be in log");
            }

            StringAssert.Contains("should be in log", log.ToString());
            StringAssert.DoesNotContain("should not be in log", log.ToString());
        }