Exemplo n.º 1
0
        public async Task Deve_Criar_Um_Usuario()
        {
            var model = UserMock.GetUserModel();

            var response = await this.Post("", model);

            Assert.True(response.IsSuccessStatusCode, response.StatusCode.ToString());
        }
Exemplo n.º 2
0
        public async Task Deve_Criar_Um_Usuario_BadRequest()
        {
            var model = UserMock.GetUserModel();

            model.Name = "";

            var response = await this.Post("", model);

            Assert.True(response.StatusCode == HttpStatusCode.BadRequest, response.StatusCode.ToString());
        }
Exemplo n.º 3
0
        public async Task <UserModel> CriarUsuarioRetornandoModel()
        {
            var model    = UserMock.GetUserModel();
            var response = await this.Post("", model);

            if (!response.IsSuccessStatusCode)
            {
                throw new Exception("Erro ao criar o usuario");
            }

            return(model);
        }
Exemplo n.º 4
0
        private async Task <Guid> CriarUsuario()
        {
            var model = UserMock.GetUserModel();

            var response = await this.Post("", model);

            if (!response.IsSuccessStatusCode)
            {
                throw new Exception("Erro ao criar o usuario");
            }
            return(JsonConvert.DeserializeObject <Guid>(await response.Content.ReadAsStringAsync()));
        }
Exemplo n.º 5
0
        private async Task <UserModel> CriarUsuarioNaoAdmin()
        {
            var model = UserMock.GetUserModel();

            model.Administrator = false;

            var response = await this.Post("", model);

            if (!response.IsSuccessStatusCode)
            {
                throw new Exception("Erro ao criar o usuario");
            }

            return(model);
        }