Exemplo n.º 1
0
        public void TestLogEntryException_AspectOnMethod()
        {
            const string expectedName = "PubComp.Aspects.Monitoring.UnitTests.MonitorMocks.MonitoredMock.ThrowSomething()";

            var target = new MonitoredMock();

            bool caughtException = false;

            try
            {
                target.ThrowSomething();
            }
            catch (ApplicationException)
            {
                caughtException = true;
            }

            Assert.IsTrue(caughtException);

            var stats = MonitorAttribute.GetStatistics(expectedName);

            Assert.AreEqual(1, stats.Entries);
            Assert.AreEqual(1, stats.Exits);
            Assert.AreEqual(1, stats.Failures);
        }