コード例 #1
0
        public void SetCurrent()
        {
            object instance = new object();
            SafeContextSingleton <object> singleton = new SafeContextSingleton <object> ("test", delegate { return(new object()); });

            Assert.That(singleton.Current, Is.Not.SameAs(instance));
            singleton.SetCurrent(instance);
            Assert.That(singleton.Current, Is.SameAs(instance));
            singleton.SetCurrent(new object());
            Assert.That(singleton.Current, Is.Not.SameAs(instance));
        }
コード例 #2
0
        public static IDisposable EnterMockStorageProviderScope(StorageProvider mock)
        {
            var previous = _innerMockStorageProvider.Current;

            _innerMockStorageProvider.SetCurrent(mock);
            return(new MockStorageProviderScope(previous));
        }
コード例 #3
0
        public void UsesSafeContext_WithGivenKey()
        {
            object instance = new object();
            SafeContextSingleton <object> singleton = new SafeContextSingleton <object> ("test", delegate { return(null); });

            singleton.SetCurrent(instance);

            Assert.That(SafeContext.Instance.GetData("test"), Is.SameAs(instance));
        }
コード例 #4
0
        public void HasCurrent()
        {
            SafeContextSingleton <object> singleton = new SafeContextSingleton <object> ("test", delegate { return(new object()); });

            Assert.That(singleton.HasCurrent, Is.False);
            Dev.Null = singleton.Current;
            Assert.That(singleton.HasCurrent, Is.True);
            singleton.SetCurrent(null);
            Assert.That(singleton.HasCurrent, Is.False);
        }
コード例 #5
0
 public static void SetCurrent(WxeContext value)
 {
     s_context.SetCurrent(value);
 }
 /// <summary>
 /// Sets the active mixin configuration configuration for the current thread.
 /// </summary>
 /// <param name="configuration">The configuration to be set, can be <see langword="null"/>.</param>
 public static void SetActiveConfiguration(MixinConfiguration configuration)
 {
     s_activeConfiguration.SetCurrent(configuration);
 }
コード例 #7
0
 private static void SetActiveScope(ClientTransactionScope scope)
 {
     s_scopeSingleton.SetCurrent(scope);
 }