public void ShouldValidateSMSWithInvalidInvite() { var smsValidationCode = "SMSValidationCodeMock"; MessagingVerification expectedResult = new MessagingVerification { HdId = "invalid" + HdIdMock, VerificationAttempts = 0, SMSValidationCode = smsValidationCode, ExpireDate = DateTime.Now.AddDays(1), }; Mock <IMessagingVerificationDelegate> messagingVerificationDelegate = new Mock <IMessagingVerificationDelegate>(); messagingVerificationDelegate.Setup(s => s.GetLastForUser(It.IsAny <string>(), It.IsAny <string>())).Returns(expectedResult); Mock <IUserProfileDelegate> userProfileDelegate = new Mock <IUserProfileDelegate>(); var userProfileMock = new Database.Wrapper.DBResult <UserProfile>() { Payload = new UserProfile(), Status = Database.Constants.DBStatusCode.Read, }; userProfileDelegate.Setup(s => s.GetUserProfile(It.IsAny <string>())).Returns(userProfileMock); userProfileDelegate.Setup(s => s.Update(It.IsAny <UserProfile>(), It.IsAny <bool>())).Returns(new Database.Wrapper.DBResult <UserProfile>()); IUserSMSService service = new UserSMSService( new Mock <ILogger <UserSMSService> >().Object, messagingVerificationDelegate.Object, userProfileDelegate.Object, new Mock <INotificationSettingsService>().Object); bool actualResult = service.ValidateSMS(HdIdMock, smsValidationCode); Assert.True(!actualResult); }