public void AKeyCanBeAddedToTheCache() { var key = Root.Any.String(); var salt = Root.Any.String(); var mock = new Mock <IRepository>(); var sut = new WordSaltCache(); sut.Init(mock.Object); sut.TryAdd(key, salt); Assert.AreEqual(salt, sut.Get(key)); }
public void GivenAKeyExistsInTheCacheAGetWillReturnTheSalt() { var key = Root.Any.String(); var salt = Root.Any.String(); var mock = new Mock <IRepository>(); mock.Setup(r => r.Get <WordMetric>(null, null, null)).Returns(new[] { new WordMetric(Root.Any.String(), key, Root.Any.Integer(), salt) }); var sut = new WordSaltCache(); sut.Init(mock.Object); var result = sut.Get(key); Assert.AreEqual(salt, result); }