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

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

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