Beispiel #1
0
 private Task AsynchronousAddition2(KeyedProducerConsumer <string, int> dictionary)
 {
     dictionary.AddOrReplace("World", "World".GetHashCode());
     dictionary.AddOrReplace("Bar", "Bar".GetHashCode());
     dictionary.AddOrReplace("Foo", "Foo".GetHashCode());
     return(Task.CompletedTask);
 }
Beispiel #2
0
        private async Task AsynchronousAddition(KeyedProducerConsumer <string, int> dictionary)
        {
            await Task.Delay(1000);

            dictionary.AddOrReplace("World", "World".GetHashCode());
            dictionary.AddOrReplace("Bar", "Bar".GetHashCode());
            await Task.Delay(1000);

            dictionary.AddOrReplace("Foo", "Foo".GetHashCode());
        }
Beispiel #3
0
        public async Task ImmediateDictionaryTest()
        {
            var dict = new KeyedProducerConsumer <string, int>();

            dict.AddOrReplace("Hello", "Hello".GetHashCode());
            var s = await dict.GetItem("Hello");

            Assert.AreEqual(s, "Hello".GetHashCode());
        }