Last active
April 3, 2020 18:04
-
-
Save samueleresca/348970b6c6ebfdbc8150d6ba58fb08ba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public async Task multiple_threads_should_get_data_correctly() | |
{ | |
LRUCache<int> cache = new LRUCache<int>(3); | |
Task[] tasks = new[] { | |
Task.Run(() => cache.Set(1, 3)), | |
Task.Run(() => cache.Set(1, 3)), | |
Task.Run(() => cache.Set(1, 3)) | |
}; | |
await Task.WhenAll(tasks); | |
Assert.NotNull(cache.Get(1)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment