ThreadStaticTests CurrentIsAvailableOutsideScopeIfFallbackSet Method Delta Engine Documentation

Namespace: DeltaEngine.Tests.Extensions
Assembly: DeltaEngine.Tests (in DeltaEngine.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public void CurrentIsAvailableOutsideScopeIfFallbackSet()
Examples

[Test]
public void CurrentIsAvailableOutsideScopeIfFallbackSet()
{
    var threadStatic = new ThreadStatic<Randomizer>(new PseudoRandom());
    using (threadStatic.Use(new FixedRandom()))
        Assert.IsTrue(threadStatic.Current is FixedRandom);
    Assert.IsTrue(threadStatic.Current is PseudoRandom);
}
See Also