Example #1
0
        public void Get_ReturnsOk_ForPheUserWithMatchingServicePermission()
        {
            // Arrange
            using (var client = Factory.WithUser <PheUserWithPermittedPhecCode>()
                                .WithNotificationAndTbServiceConnected(Utilities.DRAFT_ID, Utilities.PERMITTED_SERVICE_CODE)
                                .CreateClientWithoutRedirects())
            {
                EditSubPaths.ForEach(subPath =>
                {
                    // Act
                    var response = client.GetAsync(GetPathForId(subPath, Utilities.DRAFT_ID)).Result;

                    _output.WriteLine("Testing subpath {0}", subPath);
                    // Assert
                    Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                });
            }
        }
Example #2
0
        public void Get_ReturnsRedirect_ForRegionalUserWithoutMatchingPostcodePermission()
        {
            // Arrange
            using (var client = Factory.WithUserAuth(TestUser.RegionalUserWithPermittedPhecCode)
                                .WithNotificationAndPostcodeConnected(Utilities.DRAFT_ID, Utilities.UNPERMITTED_POSTCODE)
                                .CreateClientWithoutRedirects())
            {
                EditSubPaths.ForEach(subPath =>
                {
                    // Act
                    var response = client.GetAsync(GetPathForId(subPath, Utilities.DRAFT_ID)).Result;

                    _output.WriteLine("Testing subpath {0}", subPath);
                    // Assert
                    Assert.Equal(HttpStatusCode.Redirect, response.StatusCode);
                });
            }
        }
Example #3
0
        public void Get_ReturnsRedirectToOverview_ForNotifiedForReadOnlyUser()
        {
            // Arrange
            using (var client = Factory.WithUserAuth(TestUser.ReadOnlyUser)
                                .CreateClientWithoutRedirects())
            {
                EditSubPaths.ForEach(subPath =>
                {
                    // ActAccessToDisposedClosure
                    var response = client.GetAsync(GetPathForId(subPath, Utilities.NOTIFIED_ID)).Result;

                    _output.WriteLine("Testing subpath {0}", subPath);

                    // Assert
                    response.AssertRedirectTo($"/Notifications/{Utilities.NOTIFIED_ID}");
                });
            }
        }
Example #4
0
        public void Get_ReturnsRedirectToOverview_ForRegionalUserWithMatchingPostcodePermission()
        {
            // Arrange
            using (var client = Factory.WithUserAuth(TestUser.RegionalUserWithPermittedPhecCode)
                                .WithNotificationAndPostcodeConnected(Utilities.DRAFT_ID, Utilities.PERMITTED_POSTCODE)
                                .CreateClientWithoutRedirects())
            {
                EditSubPaths.ForEach(subPath =>
                {
                    // ActAccessToDisposedClosure
                    var response = client.GetAsync(GetPathForId(subPath, Utilities.DRAFT_ID)).Result;

                    _output.WriteLine("Testing subpath {0}", subPath);

                    // Assert
                    response.AssertRedirectTo($"/Notifications/{Utilities.DRAFT_ID}");
                });
            }
        }
Example #5
0
 public static IEnumerable <object[]> OkEditPathToIdCombinations()
 {
     return(EditSubPaths.SelectMany(path =>
                                    OkNotificationIds.Select(id => new object[] { path, id })
                                    ));
 }
Example #6
0
 public static IEnumerable <object[]> EditPageSubPaths()
 {
     return(EditSubPaths.Select(path => new object[] { path }));
 }