/// <summary> /// Generate sequence of actions that set then update then get KeyValue in provided repository. /// </summary> private static Action[] GenerateTestSeqSetUpdate(int elementsCount, MemoryKeyValueRepository store) { var actions = new Action[elementsCount]; for (var i = 0; i < elementsCount; i++) { var indx = i; actions[i] = () => { store.SetValue(indx.ToString(), indx.ToString()); store.UpdateValue(indx.ToString(), (indx + 15).ToString()); Assert.Equal(store.GetValue(indx.ToString()), (indx + 15).ToString()); }; } return(actions); }
public void UpdateNonexistentKey_Throws() { var store = new MemoryKeyValueRepository(); Assert.Throws(typeof(KeyNotFoundInRepositoryException), () => store.UpdateValue("NotExistKeyValueThrows", "NotExistKeyValueThrows")); }