public async Task DeleteSavedFilter_AsHacker_ShouldReturnForbidden_WhenPermissionMissing()
 => await PersonsControllerTestsHelper.DeleteSavedFilterAsync(
     UserType.Hacker,
     TestFactory.PlantWithAccess,
     1,
     TestFactory.AValidRowVersion,
     HttpStatusCode.Forbidden);
 public async Task DeleteSavedFilter_AsAnonymous_ShouldReturnUnauthorized()
 => await PersonsControllerTestsHelper.DeleteSavedFilterAsync(
     UserType.Anonymous,
     TestFactory.UnknownPlant,
     1,
     TestFactory.AValidRowVersion,
     HttpStatusCode.Unauthorized);
        public async Task DeleteSavedFilter_AsViewer_ShouldDeleteFilter()
        {
            var id = await PersonsControllerTestsHelper.CreateSavedFilterAsync(
                UserType.Viewer,
                TestFactory.PlantWithAccess,
                "test title 2",
                "criteria",
                true);

            var savedFilters = await PersonsControllerTestsHelper.GetSavedFiltersInProjectAsync(
                UserType.Viewer,
                TestFactory.PlantWithAccess,
                TestFactory.ProjectWithAccess);

            var savedFilter = savedFilters.Single(f => f.Id == id);

            // Act
            await PersonsControllerTestsHelper.DeleteSavedFilterAsync(
                UserType.Viewer,
                TestFactory.PlantWithAccess,
                savedFilter.Id,
                savedFilter.RowVersion);

            // Assert
            savedFilters = await PersonsControllerTestsHelper.GetSavedFiltersInProjectAsync(
                UserType.Viewer,
                TestFactory.PlantWithAccess,
                TestFactory.ProjectWithAccess);

            Assert.IsFalse(savedFilters.Exists(f => f.Id == id));
        }
 public async Task DeleteSavedFilter_AsHacker_ShouldReturnBadRequest_WhenUnknownPlant()
 => await PersonsControllerTestsHelper.DeleteSavedFilterAsync(
     UserType.Hacker,
     TestFactory.UnknownPlant,
     1,
     TestFactory.AValidRowVersion,
     HttpStatusCode.BadRequest,
     "is not a valid plant");
        public async Task DeleteSavedFilter_AsViewer_ShouldReturnConflict_WhenWrongRowVersion()
        {
            var id = await PersonsControllerTestsHelper.CreateSavedFilterAsync(
                UserType.Viewer,
                TestFactory.PlantWithAccess,
                Guid.NewGuid().ToString(),
                Guid.NewGuid().ToString(),
                true);

            // Act
            await PersonsControllerTestsHelper.DeleteSavedFilterAsync(
                UserType.Viewer,
                TestFactory.PlantWithAccess,
                id,
                TestFactory.WrongButValidRowVersion,
                HttpStatusCode.Conflict);
        }