public void ShouldCreateTest()
        {
            GlobalStaticContextualStorageStrategy globalStaticContextualStorageStrategy;
            const string KEY = "somekey";
            bool         result;
            string       value;
            string       expected;

            globalStaticContextualStorageStrategy = new GlobalStaticContextualStorageStrategy();
            globalStaticContextualStorageStrategy.ResetValues();

            // has unset
            result = globalStaticContextualStorageStrategy.HasValue(KEY);
            Assert.IsFalse(result);

            // get unset
            value = globalStaticContextualStorageStrategy.GetValue <string>(KEY);
            Assert.IsNull(value);

            // remove unset
            globalStaticContextualStorageStrategy.RemoveValue(KEY);

            // set unset
            expected = Guid.NewGuid().ToString("N");
            globalStaticContextualStorageStrategy.SetValue(KEY, expected);

            // has isset
            result = globalStaticContextualStorageStrategy.HasValue(KEY);
            Assert.IsTrue(result);

            // get isset
            value = globalStaticContextualStorageStrategy.GetValue <string>(KEY);
            Assert.IsNotNull(value);
            Assert.AreEqual(expected, value);

            // set isset
            expected = Guid.NewGuid().ToString("N");
            globalStaticContextualStorageStrategy.SetValue(KEY, expected);

            result = globalStaticContextualStorageStrategy.HasValue(KEY);
            Assert.IsTrue(result);

            value = globalStaticContextualStorageStrategy.GetValue <string>(KEY);
            Assert.IsNotNull(value);
            Assert.AreEqual(expected, value);

            // remove isset
            globalStaticContextualStorageStrategy.RemoveValue(KEY);

            // verify remove
            result = globalStaticContextualStorageStrategy.HasValue(KEY);
            Assert.IsFalse(result);

            value = globalStaticContextualStorageStrategy.GetValue <string>(KEY);
            Assert.IsNull(value);
        }
        public void ShouldCreateCrossThreadTest()
        {
            GlobalStaticContextualStorageStrategy globalStaticContextualStorageStrategy;
            const string KEY = "somekey";
            bool         result;
            string       value;
            string       expected;

            Thread thread;
            int    managedThreadId;

            managedThreadId = Thread.CurrentThread.ManagedThreadId;
            globalStaticContextualStorageStrategy = new GlobalStaticContextualStorageStrategy();
            globalStaticContextualStorageStrategy.ResetValues();

            // set unset
            expected = Guid.NewGuid().ToString("N");
            globalStaticContextualStorageStrategy.SetValue(KEY, expected);

            // has isset
            result = globalStaticContextualStorageStrategy.HasValue(KEY);
            Assert.IsTrue(result);

            // get isset
            value = globalStaticContextualStorageStrategy.GetValue <string>(KEY);
            Assert.IsNotNull(value);
            Assert.AreEqual(expected, value);

            thread = new Thread(() =>
            {
                int _managedThreadId = Thread.CurrentThread.ManagedThreadId;

                Assert.AreNotEqual(_managedThreadId, managedThreadId);

                // has isset(other thread)
                result = globalStaticContextualStorageStrategy.HasValue(KEY);
                Assert.IsTrue(result);
            });

            thread.Start();
            thread.Join();
        }