Example #1
0
        public void SetUp()
        {
            _commitmentServiceMock      = new Mock <ICommitmentService>();
            _accountServiceMock         = new Mock <IAccountService>();
            _notificationsApiClientMock = new Mock <INotificationsApi>();
            _surveyLoggerMock           = new Mock <ILogger <EmployerSurveyEmailer> >();
            _roatpService = new Mock <IRoatpService>();

            _dbConnection = new SqlConnection(_configuration.GetConnectionString("EmployerEmailStoreConnection"));
            _dbEmployerFeedbackRepository = new EmployerFeedbackRepository(_dbConnection);

            _dataRetreivalService = new EmployerFeedbackDataRetrievalService(
                _commitmentServiceMock.Object,
                _accountServiceMock.Object,
                _dbEmployerFeedbackRepository);

            _helper = new UserRefreshService(new Mock <ILogger <UserRefreshService> >().Object, _dbEmployerFeedbackRepository);
            _surveyInviteGenerator = new SurveyInviteGenerator(_options, _dbEmployerFeedbackRepository, Mock.Of <ILogger <SurveyInviteGenerator> >());
            var providerRefreshSevice = new ProviderRefreshService(_dbEmployerFeedbackRepository, _roatpService.Object);

            SetupApiMocks(2);

            _initiateFunction              = new InitiateDataRefreshFunction(_dbEmployerFeedbackRepository);
            _providersRefreshFunction      = new ProviderRefreshFunction(providerRefreshSevice);
            _accountRetrieveFunction       = new EmployerDataRetrieveFeedbackAccountsFunction(_commitmentServiceMock.Object);
            _accountDataRetrieveFunction   = new AccountRefreshFunction(_dataRetreivalService);
            _processActiveFeedbackFunction = new ProcessActiveFeedbackFunction(_helper);
            _surveyInviteGeneratorFunction = new EmployerSurveyInviteGeneratorFunction(_surveyInviteGenerator);
        }
        public WhenGenerateSurveyInvitesInvoked()
        {
            _testConfig = new EmailSettings {
                InviteCycleDays = InviteCycleDays
            };
            var config = Options.Create(_testConfig);

            _message = new GenerateSurveyCodeMessage {
                AccountId = 1, Ukprn = 88888888, UserRef = Guid.NewGuid()
            };

            _emailDetailsRepoMock = new Mock <IEmployerFeedbackRepository>();
            _emailDetailsRepoMock
            .Setup(mock => mock.UpsertIntoFeedback(_message.UserRef, _message.AccountId, _message.Ukprn))
            .ReturnsAsync(FeedBackId);

            _sut = new SurveyInviteGenerator(config, _emailDetailsRepoMock.Object, Mock.Of <ILogger <SurveyInviteGenerator> >());
        }
 public EmployerSurveyInviteGeneratorFunction(SurveyInviteGenerator surveyInviteGenerator)
 {
     _surveyInviteGenerator = surveyInviteGenerator;
 }