コード例 #1
0
        public void ThrowsException()
        {
            ITargetClass proxy = GetProxy();

            Assert.Throws <TestException>(() => proxy.Throw());
            // Calls method3 to ensure the previous exception didn't leave the stack
            // in an inconsistent state.
            proxy.Method3();

            CollectionAssert.AreEqual(new[]
            {
                "VS -> YetiCommon.Tests.CastleAspects.TargetClass: " +
                "ITargetClass.Throw",
                "YetiCommon.Tests.CastleAspects.TargetClass --> " +
                "VS: YetiCommon.Tests.CastleAspects.TestException",
                "VS -> YetiCommon.Tests.CastleAspects.TargetClass: " +
                "ITargetClass.Method3",
            }, GetNormalizedLogs());
        }
コード例 #2
0
 public void Method2() => other?.Method3();