Esempio n. 1
0
        public async Task Usuario_Post_ReturnsOk()
        {
            var request = ServicesUtil.CreateRequestContent(UsuarioFactory.CreateUsuario);

            var response = await testContext.Client.PostAsync(endpoint, request);

            response.StatusCode.Should().Be(HttpStatusCode.OK);

            var message = ServicesUtil.ReadResponseMessage(response);

            message.Should().Be(createUserMessage);
        }
Esempio n. 2
0
        public async Task Login_Post_ReturnsInternalServerError()
        {
            var auth = LoginFactory.CreateAuth("usertest", "test123");

            var request  = ServicesUtil.CreateRequestContent(auth);
            var response = await testContext.Client.PostAsync(endpointLogin, request);

            response.StatusCode.Should().Be(HttpStatusCode.InternalServerError);

            var message = ServicesUtil.ReadResponseMessage(response);

            message.Should().Be(errorAccessDenied);
        }
Esempio n. 3
0
        public async Task Usuario_Post_ReturnsInternalServerError()
        {
            var request = ServicesUtil.CreateRequestContent(UsuarioFactory.CreateUsuario);

            var responseSuccess = await testContext.Client.PostAsync(endpoint, request);

            responseSuccess.StatusCode.Should().Be(HttpStatusCode.OK);

            var messageSuccess = ServicesUtil.ReadResponseMessage(responseSuccess);

            messageSuccess.Should().Be(createUserMessage);

            var responseError = await testContext.Client.PostAsync(endpoint, request);

            responseError.StatusCode.Should().Be(HttpStatusCode.InternalServerError);

            var messageError = ServicesUtil.ReadResponseMessage(responseError);

            messageError.Should().Be(erroLoginMessage);
        }