public void Should_be_able_to_add_to_a_new_cache() { RandomCache cache = new RandomCache(10); string key = "key1"; string value = "value1"; cache.Add(key, value); cache.Exists(key).ShouldBeTrue(); }
public void adding_duplicate_keys_should_replace_value() { RandomCache cache = new RandomCache(10); string key = "key1"; string value = "value1"; cache.Add(key, value); cache.Exists(key).ShouldBeTrue(); cache.Get(key).ShouldEqual(value); value = "some new value"; cache.Add(key, value); cache.Get(key).ShouldEqual(value); }
private static void updateTestResults(Dictionary<string, int> testResults, RandomCache cache, string key) { if (!cache.Exists(key)) { testResults[key] += 1; } }