public void TryRemovePairFromAlgorithmShouldBerRemovedFromCacheTest() { //Arrange int cacheSize = 10; int nSet = 5; int key = 134; string value = "2221"; var algorithm = new MRUAlgorithm <int, string>(); var cache = new Cache <int, string>(cacheSize, nSet, algorithm); cache.Put(key, value); algorithm.Remove(); //Actual //Assert Assert.Throws <InvalidOperationException>(() => cache.Get(key)); Assert.Throws <InvalidOperationException>(() => algorithm.GetValue(key)); }
public void RemoveEntryViaAlgorithmShouldBeSuccess() { //Arrange int cacheSize = 255; int nSet = 1; double key = 6.4; double value = 2.2; var algorithm = new MRUAlgorithm <double, double>(); var cache = new Cache <double, double>(cacheSize, nSet, algorithm); cache.Put(key, value); algorithm.Remove(); //Actual //Assert Assert.Throws <InvalidOperationException>(() => algorithm.GetValue(key)); Assert.Throws <InvalidOperationException>(() => cache.Get(key)); }