示例#1
0
        private static async Task AsyncMethodB(AsyncLocalValueProvider provider, string expectedValue)
        {
            provider.SetValue("X", expectedValue);
            UT.Assert.AreEqual(expectedValue, provider.GetValue <string>("X"));
            await Task.Delay(100);

            UT.Assert.AreEqual(expectedValue, provider.GetValue <string>("X"));
        }
示例#2
0
        public void TwoProviders()
        {
            const string stringA   = "String A";
            const string stringB   = "String B";
            var          provider1 = new AsyncLocalValueProvider();

            provider1.SetValue("X", stringA);
            var provider2 = new AsyncLocalValueProvider();

            UT.Assert.AreEqual(stringA, provider2.GetValue <string>("X"));
            provider2.SetValue("X", stringB);
            UT.Assert.AreEqual(stringB, provider1.GetValue <string>("X"));
        }