public void Get() { var sut = new CorrelationCache<int>(); var corrId = Guid.NewGuid(); sut.Add(corrId, 42); Assert.AreEqual(42, sut.Get(corrId)); Assert.Throws<InvalidOperationException>(() => sut.Get(Guid.NewGuid())); }
public void Get() { var sut = new CorrelationCache <int>(); var corrId = Guid.NewGuid(); sut.Add(corrId, 42); Assert.AreEqual(42, sut.Get(corrId)); Assert.Throws <InvalidOperationException>(() => sut.Get(Guid.NewGuid())); }
public void Add() { var sut = new CorrelationCache<int>(); var corrId = Guid.NewGuid(); var now = DateTime.Now; sut.Add(corrId, 42); Assert.AreEqual(1, sut._cache.Count()); Assert.AreEqual(corrId, sut._cache[0].CorrelationId); Assert.AreEqual(42, sut._cache[0].Data); Assert.IsTrue(sut._cache[0].ExpiresAt.Subtract(now).TotalSeconds > 58 && sut._cache[0].ExpiresAt.Subtract(now).TotalSeconds < 62); }
public void Add() { var sut = new CorrelationCache <int>(); var corrId = Guid.NewGuid(); var now = DateTime.Now; sut.Add(corrId, 42); Assert.AreEqual(1, sut._cache.Count()); Assert.AreEqual(corrId, sut._cache[0].CorrelationId); Assert.AreEqual(42, sut._cache[0].Data); Assert.IsTrue(sut._cache[0].ExpiresAt.Subtract(now).TotalSeconds > 58 && sut._cache[0].ExpiresAt.Subtract(now).TotalSeconds < 62); }