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); }); } }
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); }); } }
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}"); }); } }
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}"); }); } }
public static IEnumerable <object[]> OkEditPathToIdCombinations() { return(EditSubPaths.SelectMany(path => OkNotificationIds.Select(id => new object[] { path, id }) )); }
public static IEnumerable <object[]> EditPageSubPaths() { return(EditSubPaths.Select(path => new object[] { path })); }