public void CreateReviewAsync_Test() { //fake userinfo provider for resolving userid var userInfoProvider = new Mock <IUserInfoProvider>(); userInfoProvider.Setup(x => x.GetCurrentUserInfo()).Returns(new UserInfo { Id = 123 }); var expected = new Review() { Id = 789, UserId = 123, RestaurantId = 22, Heading = "awesome!!", Content = "super food", Rating = 10 }; Review actual = null; var reviewDataManager = new Mock <IReviewDataManager>(); reviewDataManager.Setup(x => x.CreateReviewAsync(It.IsAny <Review>())).Callback <Review>(x => { actual = x; }).Returns(Task.FromResult <Review>(expected)); var reviewRepo = new ReviewRepository(reviewDataManager.Object, userInfoProvider.Object); var result = reviewRepo.CreateReviewAsync(expected.RestaurantId, expected.Heading, expected.Content, expected.Rating).Result; reviewDataManager.VerifyAll(); Assert.IsNotNull(actual); Assert.AreEqual(expected.UserId, actual.UserId); Assert.AreEqual(expected.RestaurantId, actual.RestaurantId); Assert.AreEqual(expected.Heading, actual.Heading); Assert.AreEqual(expected.Content, actual.Content); Assert.AreEqual(expected.Rating, actual.Rating); userInfoProvider.VerifyAll(); }