public void PerformanceGet_WithExistingKeyWith100000Elements_ShouldReturnElementFast() { for (int i = 0; i < DefaultCapacity; i++) { collection.Set(i.ToString(), i); } var sw = new Stopwatch(); sw.Start(); var item = this.collection.Get("99999"); sw.Stop(); Assert.IsTrue(sw.ElapsedMilliseconds <= 30); Assert.AreEqual(99999, item, "Expected value did not match"); }
public void PerformanceSet_With100000CallsOnExistingElements() { for (int i = 1; i <= DefaultCapacity; i++) { collection.Set(i.ToString(), i); } var sw = new Stopwatch(); sw.Start(); for (int i = 1; i <= DefaultCapacity; i++) { collection.Set(i.ToString(), DefaultCapacity - i); } sw.Stop(); Assert.IsTrue(sw.ElapsedMilliseconds <= 200); for (int i = 1; i < DefaultCapacity; i++) { Assert.AreEqual(DefaultCapacity - i, this.collection.Get(i.ToString()), "Expected Value did not match!"); } }