public async Task Delete_WithUserId_RemovesUsers()
        {
            using WebApplicationFactory factory = new();
            TestableUsersClient usersClient = factory.Client;
            await usersClient.PostAsync(new Web.Api.User
            {
                Id        = 42,
                FirstName = "John",
                LastName  = "Smith"
            });

            HttpClient client = factory.CreateClient();

            var values = new Dictionary <string?, string?>
            {
                { nameof(UserViewModel.Id), "42" }
            };

            using FormUrlEncodedContent content = new(values);
            HttpResponseMessage response = await client.PostAsync("/users/delete", content);

            response.EnsureSuccessStatusCode();
            Assert.AreEqual(1, usersClient.DeleteInvocationCount);
            Assert.IsNull(await usersClient.GetAsync(42));
        }
        public async Task Edit_WithInvalidModel_DoesNotUpdateUser()
        {
            using WebApplicationFactory factory = new();
            TestableUsersClient usersClient = factory.Client;
            await usersClient.PostAsync(new Web.Api.User
            {
                Id        = 42,
                FirstName = "John",
                LastName  = "Smith"
            });

            HttpClient client = factory.CreateClient();

            var values = new Dictionary <string?, string?>
            {
                { nameof(UserViewModel.Id), "42" },
                { nameof(UserViewModel.FirstName), "" }
            };

            using FormUrlEncodedContent content = new(values);
            HttpResponseMessage response = await client.PostAsync("/users/edit", content);

            response.EnsureSuccessStatusCode();
            Assert.AreEqual(0, usersClient.PutInvocationCount);
        }
        public async Task Edit_WithUserId_RetrievesUser()
        {
            using WebApplicationFactory factory = new();
            TestableUsersClient usersClient = factory.Client;
            await usersClient.PostAsync(new Web.Api.User
            {
                Id        = 42,
                FirstName = "John",
                LastName  = "Smith"
            });

            HttpClient client = factory.CreateClient();

            HttpResponseMessage response = await client.GetAsync("/users/edit/42");

            response.EnsureSuccessStatusCode();
            Assert.AreEqual(1, usersClient.GetInvocationCount);
        }