public HttpContextStorageTransfer(
     HttpContextStorage httpContextStorage,
     CallContextStorage callContextStorage,
     IHttpContextStorageTransferKeys[] httpContextStorageTransferKeys)
 {
     _httpContextStorage             = httpContextStorage;
     _callContextStorage             = callContextStorage;
     _httpContextStorageTransferKeys = httpContextStorageTransferKeys;
 }
Beispiel #2
0
            public void Should_SetValue_in_CallContext()
            {
                var key            = "testKey";
                var expected       = "Some Text";
                var contextStorage = new CallContextStorage();

                contextStorage.SetValue(key, expected);
                var actual = contextStorage.GetValue <string>(key);

                actual.ShouldBe(expected);
            }
Beispiel #3
0
            public void Should_retrieve_value()
            {
                new CallContextStorage().SetValue("MyReallyAwesomeKey", "My Cool Value");

                // Sanity Check
                var sameThreadValue = new CallContextStorage().GetValue <string>("MyReallyAwesomeKey");

                sameThreadValue.ShouldBe("My Cool Value");
                Console.WriteLine("Same thread value works fine");

                var task = Task.Run(() => TestGetValue());

                task.Wait();
            }
Beispiel #4
0
            public void Should_Get_Generic_Value_in_CallContext()
            {
                var key            = "testKey";
                var expected       = "Some Text";
                var contextStorage = new CallContextStorage();

                var testObject = new TestObject
                {
                    Text = expected
                };

                contextStorage.SetValue(key, testObject);
                var actual = contextStorage.GetValue <TestObject>(key);

                actual.Text.ShouldBe(expected);
            }
Beispiel #5
0
            private void TestGetValue()
            {
                var value = new CallContextStorage().GetValue <string>("MyReallyAwesomeKey");

                value.ShouldBe("My Cool Value");
            }