Beispiel #1
0
            public WhenSendingToProviderTestFixture()
            {
                var autoFixture = new Fixture();

                _request   = autoFixture.Create <SentRequest>();
                _viewModel = autoFixture.Create <SentViewModel>();

                var modelMapper = new Mock <IModelMapper>();

                modelMapper.Setup(x => x.Map <SentViewModel>(It.Is <SentRequest>(r => r == _request)))
                .ReturnsAsync(_viewModel);

                _linkGeneratorResult = autoFixture.Create <string>();
                var linkGenerator = new Mock <ILinkGenerator>();

                linkGenerator.Setup(x => x.CommitmentsLink(It.IsAny <string>()))
                .Returns(_linkGeneratorResult);

                CohortController = new CohortController(Mock.Of <ICommitmentsApiClient>(),
                                                        Mock.Of <ILogger <CohortController> >(),
                                                        linkGenerator.Object,
                                                        modelMapper.Object,
                                                        Mock.Of <IAuthorizationService>(),
                                                        Mock.Of <IEncodingService>());
            }
Beispiel #2
0
        internal void SentRequests()
        {
            GlobalDefinitions.wait(120);

            Actions builder = new Actions(Global.GlobalDefinitions.driver);

            builder.MoveToElement(ClickManageRequests).Build().Perform();
            ClickManageRequests.Click();

            GlobalDefinitions.wait(60);

            WebDriverWait wait = new WebDriverWait(GlobalDefinitions.driver, TimeSpan.FromSeconds(60));

            wait.Until(ExpectedConditions.ElementToBeClickable(SentRequest));
            SentRequest.Click();

            Assert.That(SentTitle.Text, Is.EqualTo("Sent Requests"));

            Base.test.Log(LogStatus.Info, "Sucessfully in Sent Requests Page");
        }
        public SentViewModelMapperTestsFixture()
        {
            _autoFixture = new Fixture();

            Cohort = _autoFixture.Create <GetCohortResponse>();

            DraftApprenticeshipsResponse = _autoFixture.Create <GetDraftApprenticeshipsResponse>();

            CommitmentsApiClient = new Mock <ICommitmentsApiClient>();
            CommitmentsApiClient.Setup(x => x.GetCohort(It.IsAny <long>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(Cohort);

            CommitmentsApiClient.Setup(x => x.GetDraftApprenticeships(It.IsAny <long>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(DraftApprenticeshipsResponse);

            EncodingService = new Mock <IEncodingService>();

            Mapper = new SentViewModelMapper(CommitmentsApiClient.Object, EncodingService.Object);
            Source = _autoFixture.Create <SentRequest>();
        }
Beispiel #4
0
 public void SentRequestsSteps()
 {
     ManageRequest.Click();
     SentRequest.Click();
 }
Beispiel #5
0
 public static WithinSentRequest <TRequest> Within <TRequest>(this SentRequest <TRequest> request, TimeSpan timeout)
 {
     return(new WithinSentRequestImpl <TRequest>(request, timeout));
 }
Beispiel #6
0
        public async Task <IActionResult> Sent(SentRequest request)
        {
            var viewModel = await _modelMapper.Map <SentViewModel>(request);

            return(View(viewModel));
        }
Beispiel #7
0
        /// <summary>
        /// Handles when the EMT clicks the submit button
        /// </summary>
        private void RequestDoctors_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(SkypeName.Text))
            {
                NotifyUser("Please enter a skype name.");
                return;
            }

            string phoneNumber = Phone.Text;
            string email       = Email.Text;
            string skypeName   = SkypeName.Text;
            Dictionary <MessageType, string> sendTypes = new Dictionary <MessageType, string>();

            // Handling Phone Number
            if (!string.IsNullOrWhiteSpace(phoneNumber))
            {
                if (phoneNumber.Length != MainPage.FormattedPhoneLength)
                {
                    NotifyUser($"Invalid Number. Please try again.");
                    return;
                }
                else if (this.numbersSentTo.Contains(phoneNumber))
                {
                    this.logger.Log($"Recently sent to {phoneNumber}. Skipping.");
                    return;  // Don't do anything
                }

                // Add phone number to set of numbers
                this.logger.Log($"Adding {phoneNumber} to {this.numbersSentTo}");
                SentRequest.Invoke(this, new RequestEventArgs(this.numbersSentTo, phoneNumber));
                sendTypes.Add(MessageType.Number, phoneNumber);
            }

            // Handling Email
            if (!string.IsNullOrWhiteSpace(email))
            {
                if (this.emailsSentTo.Contains(email))
                {
                    this.logger.Log($"Recently sent to {email}. Skipping.");
                    return;  // Don't do anything
                }

                // Add email to set of emails
                this.logger.Log($"Adding {email} to {this.emailsSentTo}");
                SentRequest.Invoke(this, new RequestEventArgs(this.emailsSentTo, email));
                sendTypes.Add(MessageType.Email, email);
            }

            // Handle sending skype name twice
            if (this.skypesSentTo.Contains(skypeName))
            {
                this.logger.Log($"Recently sent to {skypeName}. Skipping.");
                return;  // Don't do anything
            }

            // Add skype name to set of skypes
            this.logger.Log($"Adding {skypeName} to {nameof(this.skypesSentTo)}");
            SentRequest.Invoke(this, new RequestEventArgs(this.skypesSentTo, skypeName));
            sendTypes.Add(MessageType.Skype, skypeName);

            // Sending HTTP Request containing all non-empty parameters
            try
            {
                string endpoint = RequestDoctorsEndpoint;
                SendHTTP(endpoint, sendTypes); // TODO: NEED TO CHANGE SendHTTP INTERFACE
            }
            catch (Exception ex)
            {
                this.logger.Log($"Error: when notifying contact, got exception: {ex.Message}");
                NotifyUser($"Error notifying contact: {ex.Message}");
            }
        }