public void GetEnumerator_Generic_AfterTokenWasInvalidated_ReturnsEmptySequence() { var cache = new Cache <string, object>(); object exptected1 = new object(); object exptected2 = new object(); cache.Add("key1", exptected1); cache.Add("key2", exptected2); var decorated = new InvalidationTokenBasedCacheDecorator <string, object> (cache, InvalidationToken.Create()); decorated.InvalidationToken.Invalidate(); Assert.That(decorated.ToArray(), Is.Empty); }
public void GetEnumerator_Generic_ReturnsItemsFromCache() { var cache = new Cache <string, object>(); var decorator = new InvalidationTokenBasedCacheDecorator <string, object> (cache, InvalidationToken.Create()); object exptected1 = new object(); object exptected2 = new object(); cache.Add("key1", exptected1); cache.Add("key2", exptected2); Assert.That( decorator.ToArray(), Is.EquivalentTo( new[] { new KeyValuePair <string, object> ("key1", exptected1), new KeyValuePair <string, object> ("key2", exptected2) } )); }