private Tuple <RequestResult <UserProfileModel>, UserProfileModel> ExecuteCloseUserProfile(UserProfile userProfile, Database.Constants.DBStatusCode dbResultStatus = Database.Constants.DBStatusCode.Read)
        {
            UserProfileModel expected = UserProfileModel.CreateFromDbModel(userProfile);

            DBResult <UserProfile> userProfileDBResult = new DBResult <UserProfile>
            {
                Payload = userProfile,
                Status  = dbResultStatus
            };

            Mock <IUserProfileDelegate> profileDelegateMock = new Mock <IUserProfileDelegate>();

            profileDelegateMock.Setup(s => s.GetUserProfile(hdid)).Returns(userProfileDBResult);
            profileDelegateMock.Setup(s => s.Update(userProfile, true)).Returns(userProfileDBResult);

            Mock <IEmailQueueService> emailQueueServiceMock = new Mock <IEmailQueueService>();

            emailQueueServiceMock
            .Setup(s => s.QueueNewEmail(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Dictionary <string, string> >(), false));

            IHeaderDictionary headerDictionary = new HeaderDictionary();

            headerDictionary.Add("referer", "http://localhost/");
            Mock <HttpRequest> httpRequestMock = new Mock <HttpRequest>();

            httpRequestMock.Setup(s => s.Headers).Returns(headerDictionary);
            Mock <HttpContext> httpContextMock = new Mock <HttpContext>();

            httpContextMock.Setup(s => s.Request).Returns(httpRequestMock.Object);
            Mock <IHttpContextAccessor> httpContextAccessorMock = new Mock <IHttpContextAccessor>();

            httpContextAccessorMock.Setup(s => s.HttpContext).Returns(httpContextMock.Object);

            IUserProfileService service = new UserProfileService(
                new Mock <ILogger <UserProfileService> >().Object,
                new Mock <IPatientService>().Object,
                new Mock <IUserEmailService>().Object,
                new Mock <IUserSMSService>().Object,
                new Mock <IConfigurationService>().Object,
                emailQueueServiceMock.Object,
                new Mock <INotificationSettingsService>().Object,
                profileDelegateMock.Object,
                new Mock <IUserPreferenceDelegate>().Object,
                new Mock <ILegalAgreementDelegate>().Object,
                new Mock <IMessagingVerificationDelegate>().Object,
                new Mock <ICryptoDelegate>().Object,
                httpContextAccessorMock.Object);

            RequestResult <UserProfileModel> actualResult = service.CloseUserProfile(hdid, Guid.NewGuid());

            return(new Tuple <RequestResult <UserProfileModel>, UserProfileModel>(actualResult, expected));
        }