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

            UsageGuard.RunInContextExcludedFromSingleUseRule(
                () =>
                {
                    UsageGuard.RunInContextExcludedFromSingleUseRule(() => { });
                    alwaysInDifferentContext.AssertNoContextChangeOccurred(new object());
                });
        }
Esempio n. 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()));
 }
Esempio n. 4
0
        public void ThrowsIfUsedFromDifferentContext()
        {
            var alwaysInDifferentContext = new AlwayInDifferentContextUsageGuard();

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