public void DoesNotThrowIfCalledFromExcludedContextInRecursiveReentrantFashion()
        {
            var alwaysInDifferentContext = new AlwayInDifferentContextUsageGuard();

            UsageGuard.RunInContextExcludedFromSingleUseRule(
                () =>
                {
                    UsageGuard.RunInContextExcludedFromSingleUseRule(() => { });
                    alwaysInDifferentContext.AssertNoContextChangeOccurred(new object());
                });
        }
Example #2
0
        public void DoesNotThrowIfCalledFromExcludedContextInRecursiveReentrantFashion()
        {
            var alwaysInDifferentContext = new AlwayInDifferentContextUsageGuard();

            UsageGuard.RunInContextExcludedFromSingleUseRule(
                () =>
            {
                UsageGuard.RunInContextExcludedFromSingleUseRule(() => { });
                alwaysInDifferentContext.AssertNoContextChangeOccurred(new object());
            });
        }
 public void ThrowsIfUsedFromDifferentContext()
 {
     var alwaysInDifferentContext = new AlwayInDifferentContextUsageGuard();
     Assert.Throws<Exception>(() => alwaysInDifferentContext.AssertNoContextChangeOccurred(new object()));
 }
Example #4
0
        public void ThrowsIfUsedFromDifferentContext()
        {
            var alwaysInDifferentContext = new AlwayInDifferentContextUsageGuard();

            Assert.Throws <Exception>(() => alwaysInDifferentContext.AssertNoContextChangeOccurred(new object()));
        }