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); }
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()); }
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()); }