public void SetsUserTokenFromUserIdentityProvider() { // Arrange ISetChileProductIngredientsParameters actualParams = null; MockProductService.Setup(m => m.SetChileProductIngredients(It.IsAny <ISetChileProductIngredientsParameters>())) .Callback((ISetChileProductIngredientsParameters p) => actualParams = p) .Returns(new SuccessResult <string>()); const string expectedUserToken = "user13"; MockUserTokenProvider.Setup(m => m.SetUserIdentity(It.IsAny <IUserIdentifiable>())) .Callback((IUserIdentifiable o) => o.UserToken = expectedUserToken); // Act SystemUnderTest.Post("2134", Fixture.Create <SetChileProductIngredientsRequest>()); // Assert Assert.AreEqual(expectedUserToken, actualParams.UserToken); MockUserTokenProvider.Verify(m => m.SetUserIdentity(It.IsAny <IUserIdentifiable>()), Times.Once()); }