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())); }
public void ThrowsIfUsedFromDifferentContext() { var alwaysInDifferentContext = new AlwayInDifferentContextUsageGuard(); Assert.Throws <Exception>(() => alwaysInDifferentContext.AssertNoContextChangeOccurred(new object())); }