Esempio n. 1
0
        public async Task RemoveGroupAsync_GroupExistAndHasSizeGreaterThanOne_GroupNotRemoved(string id)
        {
            using TestServer testServer        = ApiTestHelper.CreateTestServer();
            using HttpClient httpClient        = testServer.CreateClient();
            using HttpResponseMessage response = await httpClient.DeleteAsync($"{MainRoute}/{id}").ConfigureAwait(false);

            Assert.Equal(HttpStatusCode.MethodNotAllowed, response.StatusCode);
        }
Esempio n. 2
0
        public async Task PostGroupAsync_AlreadyExistingGroupName_MethodNotAllowedStatusCode()
        {
            const string realGroupId = "1001";
            const string alreadyExistingGroupName = "Free";

            using TestServer testServer = ApiTestHelper.CreateTestServer();
            using HttpClient httpClient = testServer.CreateClient();

            TasksGroupResource groupResource = new TasksGroupResource {
                GroupName = alreadyExistingGroupName
            };

            using StringContent jsonContent    = new StringContent(JsonConvert.SerializeObject(groupResource), Encoding.UTF8, PostMediaType);
            using HttpResponseMessage response = await httpClient.PostAsync($"{MainRoute}/{realGroupId}", jsonContent).ConfigureAwait(false);

            Assert.Equal(HttpStatusCode.MethodNotAllowed, response.StatusCode);
        }