Example #1
0
        public void from_instance_method_in_nested_class_show_correct_CallingType()
        {
            var log = new List <LogEntry>();

            using (Log.Events().Subscribe(log.Add))
            {
                var widget = new BoundaryTests.NestedWidget();
                widget.DoStuff();
            }

            Assert.That(log.Single(e => e.EventType == TraceEventType.Start).CallingType,
                        Is.EqualTo(typeof(BoundaryTests.NestedWidget)));
            Assert.That(log.Single(e => e.EventType == TraceEventType.Start).CallingType,
                        Is.EqualTo(typeof(BoundaryTests.NestedWidget)));
        }
        public async Task from_instance_method_in_nested_class_show_correct_CallingType()
        {
            var log = new List<LogEntry>();

            using (Log.Events().Subscribe(log.Add))
            {
                var widget = new BoundaryTests.NestedWidget();
                await widget.DoStuffAsync();
            }

            Assert.That(log.Single(e => e.EventType == TraceEventType.Start).CallingType,
                        Is.EqualTo(typeof (BoundaryTests.NestedWidget)));
            Assert.That(log.Single(e => e.EventType == TraceEventType.Stop).CallingType,
                        Is.EqualTo(typeof (BoundaryTests.NestedWidget)));
        }
        public void from_instance_method_in_nested_class_show_correct_CallingMethod()
        {
            var log = new List<LogEntry>();

            using (Log.Events().Subscribe(log.Add))
            {
                var widget = new BoundaryTests.NestedWidget();
                widget.DoStuff();
            }

            Assert.That(log.Single(e => e.EventType == TraceEventType.Start).CallingMethod,
                        Is.EqualTo("DoStuff"));

            Assert.That(log.Single(e => e.EventType == TraceEventType.Start).CallingMethod,
                        Is.EqualTo("DoStuff"));
        }