public HttpContextStorageTransfer( HttpContextStorage httpContextStorage, CallContextStorage callContextStorage, IHttpContextStorageTransferKeys[] httpContextStorageTransferKeys) { _httpContextStorage = httpContextStorage; _callContextStorage = callContextStorage; _httpContextStorageTransferKeys = httpContextStorageTransferKeys; }
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); }
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(); }
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); }
private void TestGetValue() { var value = new CallContextStorage().GetValue <string>("MyReallyAwesomeKey"); value.ShouldBe("My Cool Value"); }