public async Task MoveToMoviesToSee_ForPrivilegedUser_MovesMovieToMoviesToSee()
        {
            // Arrange

            using var formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("id", "5eac4f407a15596e90c09d7b"),
            });

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.PrivilegedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/MoviesToGet/MoveToMoviesToSee/5eac4f407a15596e90c09d7b"), formContent, CancellationToken.None);

            // Assert

            ResponseAssert.VerifyRedirect(response, new Uri("/MoviesToGet", UriKind.Relative));

            using var indexResponse = await client.GetAsync(new Uri ("https://localhost:5001/MoviesToGet"), CancellationToken.None);

            await ResponseAssert.VerifyPageLoaded(indexResponse);

            // The fact, that movie was actually added to movies to see, is checked by ITs for services layer.
        }
Example #2
0
        public async Task PostRegisterUser_ForPrivilegedUser_RegistersUserCorrectly()
        {
            // Arrange

            using var formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("Email", "*****@*****.**"),
                new KeyValuePair <string, string>("Password", "Qwerty123!"),
                new KeyValuePair <string, string>("ConfirmPassword", "Qwerty123!"),
            });

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.PrivilegedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/Users/RegisterUser"), formContent, CancellationToken.None);

            // Assert

            ResponseAssert.VerifyRedirect(response, new Uri("/Users", UriKind.Relative));

            using var indexResponse = await client.GetAsync(new Uri ("https://localhost:5001/Users"), CancellationToken.None);

            await ResponseAssert.VerifyPageLoaded(indexResponse);
        }
        public async Task AddMovie_ForDuplicatedMovie_ReturnsCorrectPage()
        {
            // Arrange

            using var formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("Title", "New Movie Without Info"),
                new KeyValuePair <string, string>("Year", String.Empty),
                new KeyValuePair <string, string>("MovieUri", "https://www.kinopoisk.ru/film/777/"),
                new KeyValuePair <string, string>("PosterUri", String.Empty),
                new KeyValuePair <string, string>("RatingValue", String.Empty),
                new KeyValuePair <string, string>("RatingVotesNumber", String.Empty),
                new KeyValuePair <string, string>("Duration", String.Empty),
            });

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.PrivilegedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/MoviesToGet/AddMovie"), formContent, CancellationToken.None);

            // Assert

            ResponseAssert.VerifyRedirect(response, new Uri("/MoviesToGet", UriKind.Relative));

            using var indexResponse = await client.GetAsync(new Uri ("https://localhost:5001/MoviesToGet"), CancellationToken.None);

            await ResponseAssert.VerifyPageLoaded(indexResponse);
        }
        public async Task UpdateRole_ForPrivilegedUser_UpdatesRoleCorrectly()
        {
            // Arrange

            using var formContent = new FormUrlEncodedContent(new[]
            {
                // Here we delete permission "Permissions.MoviesToGet.Add" and add permission "Permissions.MoviesToSee.Add".
                new KeyValuePair <string, string>("Permissions[0].PermissionName", "Permissions.MoviesToGet.Add"),
                new KeyValuePair <string, string>("Permissions[1].Assigned", "true"),
                new KeyValuePair <string, string>("Permissions[1].PermissionName", "Permissions.MoviesToGet.Read"),
                new KeyValuePair <string, string>("Permissions[2].PermissionName", "Permissions.MoviesToGet.MoveToMoviesToSee"),
                new KeyValuePair <string, string>("Permissions[3].PermissionName", "Permissions.MoviesToGet.Delete"),
                new KeyValuePair <string, string>("Permissions[4].Assigned", "true"),
                new KeyValuePair <string, string>("Permissions[4].PermissionName", "Permissions.MoviesToSee.Add"),
                new KeyValuePair <string, string>("Permissions[5].Assigned", "true"),
                new KeyValuePair <string, string>("Permissions[5].PermissionName", "Permissions.MoviesToSee.Read"),
                new KeyValuePair <string, string>("Permissions[6].PermissionName", "Permissions.MoviesToSee.MarkAsSeen"),
                new KeyValuePair <string, string>("Permissions[7].PermissionName", "Permissions.MoviesToSee.Delete"),
                new KeyValuePair <string, string>("RoleId", "5eb995ef4083c272a80ca308"),
                new KeyValuePair <string, string>("Permissions[0].Assigned", "false"),
                new KeyValuePair <string, string>("Permissions[1].Assigned", "false"),
                new KeyValuePair <string, string>("Permissions[2].Assigned", "false"),
                new KeyValuePair <string, string>("Permissions[3].Assigned", "false"),
                new KeyValuePair <string, string>("Permissions[4].Assigned", "false"),
                new KeyValuePair <string, string>("Permissions[5].Assigned", "false"),
                new KeyValuePair <string, string>("Permissions[6].Assigned", "false"),
                new KeyValuePair <string, string>("Permissions[7].Assigned", "false"),
            });

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.PrivilegedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/Roles/UpdateRole"), formContent, CancellationToken.None);

            // Assert

            ResponseAssert.VerifyRedirect(response, new Uri("/Roles", UriKind.Relative));

            using var indexResponse = await client.GetAsync(new Uri ("https://localhost:5001/Roles"), CancellationToken.None);

            await ResponseAssert.VerifyPageLoaded(indexResponse);

            var expectedPermissions = new[]
            {
                "Permissions.MoviesToGet.Read",
                "Permissions.MoviesToSee.Add",
                "Permissions.MoviesToSee.Read",
            };

            using var scopeServiceProvider = webApplicationFactory.Services.CreateScope();
            var roleService    = scopeServiceProvider.ServiceProvider.GetRequiredService <IRoleService>();
            var newPermissions = (await roleService.GetRolePermissions("5eb995ef4083c272a80ca308", CancellationToken.None)).ToList();

            newPermissions.Should().BeEquivalentTo(expectedPermissions);
        }
Example #5
0
        public async Task GetLogin_ForUnauthenticatedUser_ReturnsCorrectPage()
        {
            // Arrange

            await using var webApplicationFactory = new CustomWebApplicationFactory(authenticatedUser: null);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.GetAsync(new Uri ("https://localhost:5001/Identity/Account/Login"), CancellationToken.None);

            // Assert

            await ResponseAssert.VerifyPageLoaded(response);
        }
        public async Task ConfirmRoleDeletion_ForPrivilegedUser_ReturnsCorrectPage()
        {
            // Arrange

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.PrivilegedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.GetAsync(new Uri ("https://localhost:5001/Roles/ConfirmRoleDeletion/5eb995ef4083c272a80ca308"), CancellationToken.None);

            // Assert

            await ResponseAssert.VerifyPageLoaded(response);
        }
        public async Task Access_ForDefaultAdministrator_IsAllowed()
        {
            // Arrange

            await using var webApplicationFactory = new CustomWebApplicationFactory(authenticatedUser: ApplicationUser.DefaultAdministrator, seedData: new EmptySeedData());
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.GetAsync(new Uri ("https://localhost:5001/Users"), CancellationToken.None);

            // Assert

            await ResponseAssert.VerifyPageLoaded(response);
        }
Example #8
0
        public async Task Index_ForPrivilegedUser_ReturnsCorrectPage()
        {
            // Arrange

            await using var factory = new CustomWebApplicationFactory(authenticatedUser: ApplicationUser.PrivilegedUser);
            using var client        = factory.CreateDefaultHttpClient();

            // Act

            using var response = await client.GetAsync(new Uri ("https://localhost:5001/MoviesToSee"), CancellationToken.None);

            // Assert

            await ResponseAssert.VerifyPageLoaded(response);
        }
Example #9
0
        public async Task Request_ForUnknownPage_CorrectErrorPageIsReturned()
        {
            // Arrange

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.LimitedUser, movieInfoProvider: FakeMovieInfoProvider.StubFailingProvider);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.GetAsync(new Uri ("https://localhost:5001/NoSuchPage"), CancellationToken.None);

            // Assert

            await ResponseAssert.VerifyPageLoaded(response, HttpStatusCode.NotFound);
        }
Example #10
0
        public async Task EditUser_OfNonAdministratorUnderPrivilegedUser_ReturnsCorrectPage()
        {
            // Arrange

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.PrivilegedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.GetAsync(new Uri ("https://localhost:5001/Users/EditUser/5eb7eb9f1fdada19f4eb59b1"), CancellationToken.None);

            // Assert

            await ResponseAssert.VerifyPageLoaded(response);
        }
Example #11
0
        public async Task GetRegisterUser_ForPrivilegedUser_ReturnsCorrectPage()
        {
            // Arrange

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.PrivilegedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.GetAsync(new Uri ("https://localhost:5001/Users/RegisterUser"), CancellationToken.None);

            // Assert

            await ResponseAssert.VerifyPageLoaded(response);
        }
        public async Task Index_NoMoviesToGet_ReturnsCorrectPage()
        {
            // Arrange

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.LimitedUser, seedData: new NoMoviesSeedData());
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.GetAsync(new Uri ("https://localhost:5001/MoviesToGet"), CancellationToken.None);

            // Assert

            await ResponseAssert.VerifyPageLoaded(response);
        }
Example #13
0
        public async Task ConfirmMarkingAsSeen_ForPrivilegedUser_ReturnsCorrectPage()
        {
            // Arrange

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.PrivilegedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.GetAsync(new Uri ("https://localhost:5001/MoviesToSee/ConfirmMarkingAsSeen/5ead62d14be68246b45bba82"), CancellationToken.None);

            // Assert

            await ResponseAssert.VerifyPageLoaded(response);
        }
        public async Task ConfirmMovieDeletion_ForPrivilegedUser_ReturnsCorrectPage()
        {
            // Arrange

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.PrivilegedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.GetAsync(new Uri ("https://localhost:5001/MoviesToGet/ConfirmMovieDeletion/5eac4f407a15596e90c09d7b"), CancellationToken.None);

            // Assert

            await ResponseAssert.VerifyPageLoaded(response);
        }
        public async Task AddMovie_ForLimitedUser_AddsMovieCorrectly()
        {
            // Arrange

            using var formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("Title", "Темный рыцарь"),
                new KeyValuePair <string, string>("Year", "2008"),
                new KeyValuePair <string, string>("MovieUri", "https://www.kinopoisk.ru/film/111543/"),
                new KeyValuePair <string, string>("PosterUri", "https://st.kp.yandex.net/images/film_iphone/iphone360_111543.jpg"),
                new KeyValuePair <string, string>("Directors[0]", "Кристофер Нолан"),
                new KeyValuePair <string, string>("Cast[0]", "Кристиан Бэйл"),
                new KeyValuePair <string, string>("Cast[1]", "Хит Леджер"),
                new KeyValuePair <string, string>("Cast[2]", "Аарон Экхарт"),
                new KeyValuePair <string, string>("Cast[3]", "Мэгги Джилленхол"),
                new KeyValuePair <string, string>("Cast[4]", "Гари Олдман"),
                new KeyValuePair <string, string>("Cast[5]", "Майкл Кейн"),
                new KeyValuePair <string, string>("Cast[6]", "Морган Фриман"),
                new KeyValuePair <string, string>("Cast[7]", "Чинь Хань"),
                new KeyValuePair <string, string>("Cast[8]", "Нестор Карбонелл"),
                new KeyValuePair <string, string>("Cast[9]", "Эрик Робертс"),
                new KeyValuePair <string, string>("RatingValue", "8.499"),
                new KeyValuePair <string, string>("RatingVotesNumber", "467272"),
                new KeyValuePair <string, string>("Duration", "02:32:00"),
                new KeyValuePair <string, string>("Genres[0]", "фантастика"),
                new KeyValuePair <string, string>("Genres[1]", "боевик"),
                new KeyValuePair <string, string>("Genres[2]", "триллер"),
                new KeyValuePair <string, string>("Genres[3]", "криминал"),
                new KeyValuePair <string, string>("Genres[4]", "драма"),
                new KeyValuePair <string, string>("SummaryParagraphs[0]", "Бэтмен поднимает ставки в войне с криминалом."),
                new KeyValuePair <string, string>("SummaryParagraphs[1]", "С помощью лейтенанта Джима Гордона и прокурора Харви Дента он намерен очистить улицы Готэма от преступности."),
            });

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.LimitedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/MoviesToGet/AddMovie"), formContent, CancellationToken.None);

            // Assert

            ResponseAssert.VerifyRedirect(response, new Uri("/MoviesToGet", UriKind.Relative));

            using var indexResponse = await client.GetAsync(new Uri ("https://localhost:5001/MoviesToGet"), CancellationToken.None);

            await ResponseAssert.VerifyPageLoaded(indexResponse);
        }
Example #16
0
        public async Task UpdateUser_ForPrivilegedUser_UpdatesUserCorrectly()
        {
            // Arrange

            using var formContent = new FormUrlEncodedContent(new[]
            {
                // Here we delete role "Limited User" and add role "Privileged User".
                new KeyValuePair <string, string>("Roles[0].RoleName", "Administrator"),
                new KeyValuePair <string, string>("Roles[1].Assigned", "true"),
                new KeyValuePair <string, string>("Roles[1].RoleName", "Privileged User"),
                new KeyValuePair <string, string>("Roles[2].RoleName", "Limited User"),
                new KeyValuePair <string, string>("UserId", "5eb7eb9f1fdada19f4eb59b1"),
                new KeyValuePair <string, string>("Roles[0].Assigned", "false"),
                new KeyValuePair <string, string>("Roles[1].Assigned", "false"),
                new KeyValuePair <string, string>("Roles[2].Assigned", "false"),
            });

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.PrivilegedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/Users/UpdateUser"), formContent, CancellationToken.None);

            // Assert

            ResponseAssert.VerifyRedirect(response, new Uri("/Users", UriKind.Relative));

            using var indexResponse = await client.GetAsync(new Uri ("https://localhost:5001/Users"), CancellationToken.None);

            await ResponseAssert.VerifyPageLoaded(indexResponse);

            var expectedRoles = new[]
            {
                "Privileged User",
            };

            using var scopeServiceProvider = webApplicationFactory.Services.CreateScope();
            var userService  = scopeServiceProvider.ServiceProvider.GetRequiredService <IUserService>();
            var newUserRoles = await userService.GetUserRoles("5eb7eb9f1fdada19f4eb59b1", CancellationToken.None);

            newUserRoles.Select(r => r.RoleName).Should().BeEquivalentTo(expectedRoles, x => x.WithStrictOrdering());
        }
        public async Task PostCreateRole_ForPrivilegedUser_CreatesRoleCorrectly()
        {
            // Arrange

            using var formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("Name", "Some New Role"),
                new KeyValuePair <string, string>("Permissions[0].Assigned", "true"),
                new KeyValuePair <string, string>("Permissions[0].PermissionName", "Permissions.MoviesToGet.Add"),
                new KeyValuePair <string, string>("Permissions[1].Assigned", "true"),
                new KeyValuePair <string, string>("Permissions[1].PermissionName", "Permissions.MoviesToGet.Read"),
                new KeyValuePair <string, string>("Permissions[2].PermissionName", "Permissions.MoviesToGet.MoveToMoviesToSee"),
                new KeyValuePair <string, string>("Permissions[3].PermissionName", "Permissions.MoviesToGet.Delete"),
                new KeyValuePair <string, string>("Permissions[4].PermissionName", "Permissions.MoviesToSee.Add"),
                new KeyValuePair <string, string>("Permissions[5].Assigned", "true"),
                new KeyValuePair <string, string>("Permissions[5].PermissionName", "Permissions.MoviesToSee.Read"),
                new KeyValuePair <string, string>("Permissions[6].PermissionName", "Permissions.MoviesToSee.MarkAsSeen"),
                new KeyValuePair <string, string>("Permissions[7].PermissionName", "Permissions.MoviesToSee.Delete"),
                new KeyValuePair <string, string>("Permissions[0].Assigned", "false"),
                new KeyValuePair <string, string>("Permissions[1].Assigned", "false"),
                new KeyValuePair <string, string>("Permissions[2].Assigned", "false"),
                new KeyValuePair <string, string>("Permissions[3].Assigned", "false"),
                new KeyValuePair <string, string>("Permissions[4].Assigned", "false"),
                new KeyValuePair <string, string>("Permissions[5].Assigned", "false"),
                new KeyValuePair <string, string>("Permissions[6].Assigned", "false"),
                new KeyValuePair <string, string>("Permissions[7].Assigned", "false"),
            });

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.PrivilegedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/Roles/CreateRole"), formContent, CancellationToken.None);

            // Assert

            ResponseAssert.VerifyRedirect(response, new Uri("/Roles", UriKind.Relative));

            using var indexResponse = await client.GetAsync(new Uri ("https://localhost:5001/Roles"), CancellationToken.None);

            await ResponseAssert.VerifyPageLoaded(indexResponse);
        }
Example #18
0
        public async Task ControllerAction_UnhandledExceptionIsThrown_ReturnsCorrectErrorPage()
        {
            // Arrange

            using var formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("NewMovieToGet.MovieUri", "https://www.kinopoisk.ru/film/111543/"),
            });

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.LimitedUser, movieInfoProvider: FakeMovieInfoProvider.StubFailingProvider);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/MoviesToGet/ConfirmMovieAdding"), formContent, CancellationToken.None);

            // Assert

            await ResponseAssert.VerifyPageLoaded(response, HttpStatusCode.InternalServerError);
        }
        public async Task ConfirmMovieAdding_ForPrivilegedUserAndMovieWithAllInfoMissing_ReturnsCorrectPage()
        {
            // Arrange

            using var formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("NewMovieToGet.MovieUri", "https://www.kinopoisk.ru/film/13/"),
            });

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.PrivilegedUser, movieInfoProvider: FakeMovieInfoProvider.StubMovieInfoWithAllInfoMissing);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/MoviesToGet/ConfirmMovieAdding"), formContent, CancellationToken.None);

            // Assert

            await ResponseAssert.VerifyPageLoaded(response);
        }
Example #20
0
        public async Task PostRegisterUser_ForInvalidModel_ReturnsCorrectPage()
        {
            // Arrange

            using var formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("Email", String.Empty),
                new KeyValuePair <string, string>("Password", "Some Password"),
                new KeyValuePair <string, string>("ConfirmPassword", "Another Password"),
            });

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.PrivilegedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/Users/RegisterUser"), formContent, CancellationToken.None);

            // Assert

            await ResponseAssert.VerifyPageLoaded(response);
        }
        public async Task DeleteMovie_ForPrivilegedUser_DeletesMovieCorrectly()
        {
            // Arrange

            using var formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("id", "5eac4f407a15596e90c09d7b"),
            });

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.PrivilegedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/MoviesToGet/DeleteMovie"), formContent, CancellationToken.None);

            // Assert

            ResponseAssert.VerifyRedirect(response, new Uri("/MoviesToGet", UriKind.Relative));

            using var indexResponse = await client.GetAsync(new Uri ("https://localhost:5001/MoviesToGet"), CancellationToken.None);

            await ResponseAssert.VerifyPageLoaded(indexResponse);
        }
Example #22
0
        public async Task MarkMovieAsSeen_ForPrivilegedUser_DeletesMovie()
        {
            // Arrange

            using var formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("id", "5ead62d14be68246b45bba82"),
            });

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.PrivilegedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/MoviesToSee/MarkMovieAsSeen/5ead62d14be68246b45bba82"), formContent, CancellationToken.None);

            // Assert

            ResponseAssert.VerifyRedirect(response, new Uri("/MoviesToSee", UriKind.Relative));

            using var indexResponse = await client.GetAsync(new Uri ("https://localhost:5001/MoviesToSee"), CancellationToken.None);

            await ResponseAssert.VerifyPageLoaded(indexResponse);
        }
Example #23
0
        public async Task DeleteUser_ForPrivilegedUser_ReturnsCorrectPage()
        {
            // Arrange

            using var formContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("id", "5eb7eb9f1fdada19f4eb59b1"),
            });

            await using var webApplicationFactory = new CustomWebApplicationFactory(ApplicationUser.PrivilegedUser);
            using var client = webApplicationFactory.CreateDefaultHttpClient();

            // Act

            using var response = await client.PostAsync(new Uri ("https://localhost:5001/Users/DeleteUser"), formContent, CancellationToken.None);

            // Assert

            ResponseAssert.VerifyRedirect(response, new Uri("/Users", UriKind.Relative));

            using var indexResponse = await client.GetAsync(new Uri ("https://localhost:5001/Users"), CancellationToken.None);

            await ResponseAssert.VerifyPageLoaded(indexResponse);
        }