Exemple #1
0
        public async Task DeletePatientsOkRequest()
        {
            // arrange
            TestClient           testClient         = new TestClient();
            const string         endpoint           = "patient/delete/?id=testpatient";
            const HttpStatusCode expectedStatusCode = HttpStatusCode.OK;

            testClient.AddHeader("ApiKey", "testcarer");

            // act
            HttpResponseMessage response = await testClient.DeleteRequest(endpoint);

            HttpStatusCode actualStatusCode = response.StatusCode;

            // assert
            Assert.Equal(expectedStatusCode, actualStatusCode);
        }
        public async Task StickiesDeleteUnauthorised()
        {
            // arrange
            TestClient           testClient         = new TestClient();
            const string         endpoint           = "stickies/delete/?id=dasdaoi";
            const HttpStatusCode expectedStatusCode = HttpStatusCode.Unauthorized;
            const string         expectedResponse   = "Patient does not own that sticky note.";

            testClient.AddHeader("ApiKey", "testpatient");

            // act
            HttpResponseMessage response = await testClient.DeleteRequest(endpoint);

            HttpStatusCode actualStatusCode = response.StatusCode;
            string         actualResponse   = await response.Content.ReadAsStringAsync();

            // assert
            Assert.Equal(expectedStatusCode, actualStatusCode);
            Assert.Equal(expectedResponse, actualResponse);
        }
        public async Task StickiesDeleteOkRequest()
        {
            // arrange
            TestClient           testClient         = new TestClient();
            const string         endpoint           = "stickies/delete/?id=testpatient";
            const HttpStatusCode expectedStatusCode = HttpStatusCode.OK;
            const string         expectedResponse   = "Sticky note deleted successfully.";

            testClient.AddHeader("ApiKey", "testpatient");

            // act
            HttpResponseMessage response = await testClient.DeleteRequest(endpoint);

            HttpStatusCode actualStatusCode = response.StatusCode;
            string         actualResponse   = await response.Content.ReadAsStringAsync();

            // assert
            Assert.Equal(expectedStatusCode, actualStatusCode);
            Assert.Equal(expectedResponse, actualResponse);
        }
Exemple #4
0
        public async Task DeletePatientsNotFound_NoPatient()
        {
            // arrange
            TestClient           testClient         = new TestClient();
            const string         endpoint           = "patient/delete/?id=doesnotexist123";
            const string         expectedResponse   = "Patient not found.";
            const HttpStatusCode expectedStatusCode = HttpStatusCode.NotFound;

            testClient.AddHeader("ApiKey", "testcarer");

            // act
            HttpResponseMessage response = await testClient.DeleteRequest(endpoint);

            string actualResponse = await response.Content.ReadAsStringAsync();

            HttpStatusCode actualStatusCode = response.StatusCode;

            // assert
            Assert.Equal(expectedStatusCode, actualStatusCode);
            Assert.Equal(expectedResponse, actualResponse);
        }
Exemple #5
0
        public async Task DeleteCalendarUnauthorised()
        {
            // arrange
            TestClient           testClient         = new TestClient();
            const string         endpoint           = "calendar/delete/?id=testpatient";
            const HttpStatusCode expectedStatusCode = HttpStatusCode.Unauthorized;
            const string         expectedResponse   = "You are not assigned to that patient.";

            testClient.AddHeader("ApiKey", "testcarer_nopatients");

            // act
            HttpResponseMessage response = await testClient.DeleteRequest(endpoint);

            string actualResponse = await response.Content.ReadAsStringAsync();

            HttpStatusCode actualStatusCode = response.StatusCode;

            // assert
            Assert.Equal(expectedStatusCode, actualStatusCode);
            Assert.Equal(expectedResponse, actualResponse);
        }
Exemple #6
0
        public async Task DeleteCalendarNotFound()
        {
            // arrange
            TestClient           testClient         = new TestClient();
            const string         endpoint           = "calendar/delete/?id=thisdoesntexist";
            const HttpStatusCode expectedStatusCode = HttpStatusCode.NotFound;
            const string         expectedResponse   = "Could not find an entry with that id.";

            testClient.AddHeader("ApiKey", "testcarer");

            // act
            HttpResponseMessage response = await testClient.DeleteRequest(endpoint);

            string actualResponse = await response.Content.ReadAsStringAsync();

            HttpStatusCode actualStatusCode = response.StatusCode;

            // assert
            Assert.Equal(expectedStatusCode, actualStatusCode);
            Assert.Equal(expectedResponse, actualResponse);
        }