public void GetEnumerator_NonGeneric_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.ToNonGenericEnumerable().Cast <KeyValuePair <string, object> >(), Is.Empty); }
public void GetEnumerator_NonGeneric_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.ToNonGenericEnumerable(), Is.EquivalentTo( new[] { new KeyValuePair <string, object> ("key1", exptected1), new KeyValuePair <string, object> ("key2", exptected2) } )); }