public void IncrementDocument() { const string key = "sample::counter"; var repo = new SampleModelRepository(); var counterValue = repo.Increment(key, 1); // since the first increment is to setup the document the counter value should be 0 Assert.AreEqual(0, counterValue); counterValue = repo.Increment(key, 1); Assert.AreEqual(1, counterValue); repo.RemoveDocument(key); }
public void DecrementDocument() { const string key = "sample::counter"; var repo = new SampleModelRepository(); // increment the counter to the value of 2 repo.Increment(key, 1); repo.Increment(key, 1); var counterValue = repo.Increment(key, 1); Assert.AreEqual(2, counterValue); // remove 1 from the counter counterValue = repo.Decrement(key, 1); Assert.AreEqual(1, counterValue); repo.RemoveDocument(key); }