public void Push_UserDoesNotExistBefore_CreatesNewMStackInDb() { var mStackService = new MStackService(_memoryCacheMock.Object); var result = mStackService.Push(_user, _message); object expectedValue = null; _memoryCacheMock .Setup(m => m.TryGetValue(It.IsAny <string>(), out expectedValue)) .Returns(false); Assert.Equal(MStackService.ResultType.UserAdded, result); _memoryCacheMock.Verify(x => x.CreateEntry(_user)); }
public void Push_UserAlreadyExists_UpdateMStackForTheUser() { var messages = new Stack <string>(); messages.Push(_message); var mStack = new MStack { User = _user, Messages = messages }; object expectedValue = mStack; _memoryCacheMock .Setup(m => m.TryGetValue(It.IsAny <string>(), out expectedValue)) .Returns(true); var mStackService = new MStackService(_memoryCacheMock.Object); var result = mStackService.Push(_user, _message); Assert.Equal(MStackService.ResultType.UserUpdated, result); _memoryCacheMock.Verify(x => x.CreateEntry(_user)); }
public string ProcessRequest(MStackService mStackService) { var resType = (mStackService.Push(_user, CleanUtterance(_originalUtterance))); return(_resultMessages[resType]); }