Пример #1
0
        public async Task RedirectsToOverviewWithCorrectAnchorFragment_ForNotified()
        {
            // Arrange
            const int id       = Utilities.NOTIFIED_ID;
            var       url      = GetCurrentPathForId(id);
            var       document = await GetDocumentForUrlAsync(url);

            var formData = new Dictionary <string, string>
            {
                ["NotificationId"]                      = id.ToString(),
                ["HospitalDetails.HospitalId"]          = Utilities.HOSPITAL_ABINGDON_COMMUNITY_HOSPITAL_ID,
                ["HospitalDetails.TBServiceCode"]       = Utilities.TBSERVICE_ABINGDON_COMMUNITY_HOSPITAL_ID,
                ["HospitalDetails.Consultant"]          = "Consultant",
                ["HospitalDetails.CaseManagerUsername"] = Utilities.CASEMANAGER_ABINGDON_EMAIL,
                ["FormattedNotificationDate.Day"]       = "1",
                ["FormattedNotificationDate.Month"]     = "1",
                ["FormattedNotificationDate.Year"]      = "2012",
            };

            // Act
            var result = await Client.SendPostFormWithData(document, formData, url);

            // Assert
            var sectionAnchorId = OverviewSubPathToAnchorMap.GetOverviewAnchorId(NotificationSubPath);

            result.AssertRedirectTo($"/Notifications/{id}#{sectionAnchorId}");
        }
Пример #2
0
        public async Task RedirectsToOverviewWithCorrectAnchorFragment_ForNotified()
        {
            // Arrange
            const int id       = Utilities.NOTIFIED_ID;
            var       url      = GetCurrentPathForId(id);
            var       document = await GetDocumentForUrlAsync(url);

            var formData = new Dictionary <string, string>
            {
                ["NotificationId"] = id.ToString(),
                ["FormattedMdrTreatmentDate.Day"]        = "02",
                ["FormattedMdrTreatmentDate.Month"]      = "03",
                ["FormattedMdrTreatmentDate.Year"]       = "2021",
                ["MDRDetails.ExposureToKnownCaseStatus"] = "Yes",
                ["MDRDetails.RelationshipToCase"]        = "Cousins",
                ["MDRDetails.NotifiedToPheStatus"]       = "No",
                ["MDRDetails.CountryId"]             = "235",
                ["MDRDetails.RelatedNotificationId"] = $"{Utilities.NOTIFIED_ID}",
            };

            // Act
            var result = await Client.SendPostFormWithData(document, formData, url);

            // Assert
            var sectionAnchorId = OverviewSubPathToAnchorMap.GetOverviewAnchorId(NotificationSubPath);

            result.AssertRedirectTo($"/Notifications/{id}#{sectionAnchorId}");
        }
Пример #3
0
        public async Task RedirectsToOverviewWithCorrectAnchorFragment_ForNotified()
        {
            // Arrange
            const int id       = Utilities.NOTIFIED_ID;
            var       url      = GetCurrentPathForId(id);
            var       document = await GetDocumentForUrlAsync(url);

            var formData = new Dictionary <string, string>
            {
                ["NotificationId"]             = id.ToString(),
                ["PatientDetails.GivenName"]   = "Test",
                ["PatientDetails.FamilyName"]  = "User",
                ["FormattedDob.Day"]           = "5",
                ["FormattedDob.Month"]         = "5",
                ["FormattedDob.Year"]          = "2000",
                ["PatientDetails.NhsNumber"]   = "5864552852",
                ["PatientDetails.Postcode"]    = "NW5 1TL",
                ["PatientDetails.EthnicityId"] = "1",
                ["PatientDetails.SexId"]       = "1",
                ["PatientDetails.CountryId"]   = "1",
            };

            // Act
            var result = await Client.SendPostFormWithData(document, formData, url);

            // Assert
            var sectionAnchorId = OverviewSubPathToAnchorMap.GetOverviewAnchorId(NotificationSubPath);

            result.AssertRedirectTo($"/Notifications/{id}#{sectionAnchorId}");
        }
        public async Task EditPage_RedirectsToOverviewWithCorrectAnchorFragmentAndSavesContent_IfModelValid()
        {
            // Arrange
            const int id       = Utilities.NOTIFICATION_ID_WITH_MBOVIS_NULL_OTHER_CASE_NO_ENTITIES;
            var       url      = GetCurrentPathForId(id);
            var       document = await GetDocumentForUrlAsync(url);

            var formData = new Dictionary <string, string>
            {
                ["NotificationId"] = id.ToString(),
                ["MBovisDetails.ExposureToKnownCasesStatus"] = Status.No.ToString()
            };

            // Act
            var result = await Client.SendPostFormWithData(document, formData, url);

            // Assert
            var sectionAnchorId = OverviewSubPathToAnchorMap.GetOverviewAnchorId(NotificationSubPath);

            result.AssertRedirectTo($"/Notifications/{id}#{sectionAnchorId}");

            var reloadedPage = await Client.GetAsync(url);

            var reloadedDocument = await GetDocumentAsync(reloadedPage);

            reloadedDocument.AssertInputRadioValue("has-exposure-no", true);
        }
        public async Task OverviewPageContainsAnchorId_ForNotificationSubPath()
        {
            // Arrange
            var url = GetCurrentPathForId(Utilities.NOTIFIED_ID);

            // Act
            var document = await GetDocumentForUrlAsync(url);

            // Assert
            new List <string>
            {
                NotificationSubPaths.EditPatientDetails,
                NotificationSubPaths.EditHospitalDetails,
                NotificationSubPaths.EditClinicalDetails,
                NotificationSubPaths.EditContactTracing,
                NotificationSubPaths.EditTestResults,
                NotificationSubPaths.EditSocialRiskFactors,
                NotificationSubPaths.EditTravel,
                NotificationSubPaths.EditComorbidities,
                NotificationSubPaths.EditSocialContextAddresses,
                NotificationSubPaths.EditSocialContextVenues,
                NotificationSubPaths.EditPreviousHistory,
                NotificationSubPaths.EditMDRDetails,
                NotificationSubPaths.EditMBovisExposureToKnownCases,
                NotificationSubPaths.EditMBovisUnpasteurisedMilkConsumptions,
                NotificationSubPaths.EditMBovisOccupationExposures,
                NotificationSubPaths.EditMBovisAnimalExposures
            }.ForEach(subPath =>
            {
                var expectedAnchorString = OverviewSubPathToAnchorMap.GetOverviewAnchorId(subPath);
                Assert.NotNull(document.QuerySelector($"#{expectedAnchorString}-title"));
            });
        }
        public async Task PostNotified_CaseManagerAlreadyOnNotificationDoesNotMatchTbService_IsValid()
        {
            // Arrange
            const int id       = Utilities.NOTIFIED_WITH_ACTIVE_CASEMANAGER_NOT_IN_TB_SERVICE;
            var       url      = GetCurrentPathForId(id);
            var       document = await GetDocumentForUrlAsync(url);

            var formData = new Dictionary <string, string>
            {
                ["NotificationId"]                  = id.ToString(),
                ["HospitalDetails.HospitalId"]      = Utilities.HOSPITAL_ABINGDON_COMMUNITY_HOSPITAL_ID,
                ["HospitalDetails.TBServiceCode"]   = Utilities.TBSERVICE_ABINGDON_COMMUNITY_HOSPITAL_ID,
                ["HospitalDetails.Consultant"]      = "Consultant",
                ["HospitalDetails.CaseManagerId"]   = Utilities.CASEMANAGER_GATESHEAD_ID2.ToString(),
                ["FormattedNotificationDate.Day"]   = "1",
                ["FormattedNotificationDate.Month"] = "1",
                ["FormattedNotificationDate.Year"]  = "2012",
            };

            // Act
            var result = await Client.SendPostFormWithData(document, formData, url);

            // Assert
            var sectionAnchorId = OverviewSubPathToAnchorMap.GetOverviewAnchorId(NotificationSubPath);

            result.AssertRedirectTo($"/Notifications/{id}#{sectionAnchorId}");
        }
Пример #7
0
        // By default saving a notified record takes user to Overview page,
        // but this can be overriden for sub-entity pages such as TestResult
        protected virtual IActionResult RedirectForNotified()
        {
            var overviewAnchorId = OverviewSubPathToAnchorMap.GetOverviewAnchorId(CurrentPage);

            return(RedirectToPage(
                       pageName: "/Notifications/Overview",
                       pageHandler: null,
                       routeValues: new { NotificationId },
                       fragment: overviewAnchorId));
        }
        protected override IActionResult RedirectForNotified()
        {
            if (Request.Method == "POST" && Request.Form?["SaveAndRouteToTreatmentEvents"].FirstOrDefault() != null)
            {
                return(RedirectToPage("./TreatmentEvents", new { NotificationId }));
            }
            var overviewAnchorId = OverviewSubPathToAnchorMap.GetOverviewAnchorId(CurrentPage);

            return(RedirectToPage(
                       pageName: "/Notifications/Overview",
                       pageHandler: null,
                       routeValues: new { NotificationId },
                       fragment: overviewAnchorId));
        }
        public async Task RedirectsToOverviewWithCorrectAnchorFragment_ForNotified()
        {
            // Arrange
            const int id = Utilities.NOTIFIED_ID;
            var       notificationSubPath = NotificationSubPaths.EditSocialContextAddresses;
            var       url      = GetPathForId(notificationSubPath, id);
            var       document = await GetDocumentForUrlAsync(url);

            // Act
            var result = await Client.SendPostFormWithData(document, null, url);

            // Assert
            var sectionAnchorId = OverviewSubPathToAnchorMap.GetOverviewAnchorId(notificationSubPath);

            result.AssertRedirectTo($"/Notifications/{id}#{sectionAnchorId}");
        }
        public async Task RedirectsToOverviewWithCorrectAnchorFragment_ForNotified()
        {
            // Arrange
            const int id       = Utilities.NOTIFIED_ID;
            var       url      = GetCurrentPathForId(id);
            var       document = await GetDocumentForUrlAsync(url);

            var formData = new Dictionary <string, string>
            {
                ["NotificationId"] = id.ToString(),
            };

            // Act
            var result = await Client.SendPostFormWithData(document, formData, url);

            // Assert
            var sectionAnchorId = OverviewSubPathToAnchorMap.GetOverviewAnchorId(NotificationSubPath);

            result.AssertRedirectTo($"/Notifications/{id}#{sectionAnchorId}");
        }
        public async Task RedirectsToOverviewWithCorrectAnchorFragment_ForNotified()
        {
            // Arrange
            const int id       = Utilities.NOTIFIED_ID;
            var       url      = GetCurrentPathForId(id);
            var       document = await GetDocumentForUrlAsync(url);

            var formData = new Dictionary <string, string>
            {
                ["NotificationId"] = id.ToString(),
                ["NotificationSiteMap[PULMONARY]"]               = "true",
                ["NotificationSiteMap[OTHER]"]                   = "true",
                ["OtherSite.SiteDescription"]                    = "tissue",
                ["ClinicalDetails.BCGVaccinationState"]          = "Yes",
                ["ClinicalDetails.BCGVaccinationYear"]           = "2000",
                ["ClinicalDetails.IsSymptomatic"]                = "true",
                ["FormattedSymptomDate.Day"]                     = "1",
                ["FormattedSymptomDate.Month"]                   = "1",
                ["FormattedSymptomDate.Year"]                    = "2011",
                ["FormattedFirstPresentationDate.Day"]           = "2",
                ["FormattedFirstPresentationDate.Month"]         = "2",
                ["FormattedFirstPresentationDate.Year"]          = "2012",
                ["FormattedTbServicePresentationDate.Day"]       = "3",
                ["FormattedTbServicePresentationDate.Month"]     = "3",
                ["FormattedTbServicePresentationDate.Year"]      = "2013",
                ["FormattedDiagnosisDate.Day"]                   = "4",
                ["FormattedDiagnosisDate.Month"]                 = "4",
                ["FormattedDiagnosisDate.Year"]                  = "2014",
                ["ClinicalDetails.IsPostMortem"]                 = "false",
                ["ClinicalDetails.IsDotOffered"]                 = "Yes",
                ["ClinicalDetails.EnhancedCaseManagementStatus"] = "No"
            };

            // Act
            var result = await Client.SendPostFormWithData(document, formData, url);

            // Assert
            var sectionAnchorId = OverviewSubPathToAnchorMap.GetOverviewAnchorId(NotificationSubPath);

            result.AssertRedirectTo($"/Notifications/{id}#{sectionAnchorId}");
        }
Пример #12
0
        public async Task RedirectsToOverviewWithCorrectAnchorFragment()
        {
            // Arrange
            const int id       = Utilities.NOTIFICATION_ID_WITH_MBOVIS_MILK_ENTITIES;
            var       url      = GetCurrentPathForId(id);
            var       document = await GetDocumentForUrlAsync(url);

            var formData = new Dictionary <string, string>
            {
                ["NotificationId"] = id.ToString(),
                ["MBovisDetails.HasUnpasteurisedMilkConsumption"] = "false"
            };

            // Act
            var result = await Client.SendPostFormWithData(document, formData, url);

            // Assert
            var sectionAnchorId = OverviewSubPathToAnchorMap.GetOverviewAnchorId(NotificationSubPath);

            result.AssertRedirectTo($"/Notifications/{id}#{sectionAnchorId}");
        }
Пример #13
0
        public async Task PostNotified_RedirectsToCorrectSectionOfOverview_IfModelValid()
        {
            // Arrange
            const int id              = Utilities.NOTIFIED_ID;
            var       url             = GetCurrentPathForId(id);
            var       initialDocument = await GetDocumentForUrlAsync(url);

            var formData = new Dictionary <string, string>
            {
                ["NotificationId"]            = id.ToString(),
                ["TravelDetails.HasTravel"]   = "No",
                ["VisitorDetails.HasVisitor"] = "No"
            };

            // Act
            var result = await Client.SendPostFormWithData(initialDocument, formData, url);

            // Assert
            Assert.Equal(HttpStatusCode.Redirect, result.StatusCode);
            var sectionAnchorId = OverviewSubPathToAnchorMap.GetOverviewAnchorId(NotificationSubPath);

            result.AssertRedirectTo($"/Notifications/{id}#{sectionAnchorId}");
        }
 public static string GetSectionIdFromSection(string section)
 {
     return(OverviewSubPathToAnchorMap.GetOverviewAnchorId(
                (string)typeof(NotificationSubPaths).GetProperty($"Edit{section}").GetValue(null, null)));
 }