Exemple #1
0
        public void Add_User_With_Service_Request()
        {
            var request = new ServiceRequest(FormMethod.Post, ContentType.Json);

            request.Token = this.Token;
            request.Action = "user";

            var data = new
            {
                Name = "hwashburne",
                Password = DataHelper.RandomString(20)
            };

            request.Content = data;

            var response = request.Execute();

            Assert.IsTrue(response.Content.UserId != 0);
        }
Exemple #2
0
        public void Delete_User_With_Service_Request()
        {
            var data = UserTestHelper.AddUser(this.Token, "dbook");

            var request = new ServiceRequest(FormMethod.Delete, ContentType.Json);

            request.Token = this.Token;
            request.Action = "user/" + data.UserId;
            request.Content = data;

            var response = request.Execute();
        }
Exemple #3
0
        public void Get_User_With_Service_Request()
        {
            var request = new ServiceRequest(FormMethod.Get, ContentType.Json);

            request.Token = this.Token;
            request.Action = "user/2";

            var response = request.Execute();

            Assert.IsTrue(response.Content.UserId == "2");
        }
Exemple #4
0
        public void Edit_User_With_Service_Request()
        {
            var data = UserTestHelper.AddUser(this.Token, "rtam");

            var request = new ServiceRequest(FormMethod.Put, ContentType.Json);

            request.Token = this.Token;
            request.Action = "user";

            data.Name = "stam";

            request.Content = data;

            var response = request.Execute();

            Assert.IsTrue(response.Content.Name == "stam");
        }
        public void Authenticate_User_With_Service_Request()
        {
            var request = new ServiceRequest(FormMethod.Post, ContentType.Json);

            request.Action = "authenticate";

            var data = new
            {
                Name = "mreynolds",
                Password = "******"
            };

            request.Content = data;

            var response = request.Execute();

            Assert.IsTrue(response.Content.Token != string.Empty);
        }
        public void Authenticate_User_With_Bad_Password_With_Service_Request()
        {
            var request = new ServiceRequest(FormMethod.Post, ContentType.Json);

            request.Action = "authenticate";

            var data = new
            {
                Name = "mreynolds",
                Password = "******"
            };

            request.Content = data;

            var response = request.Execute();

            Assert.IsTrue(response.StatusCode == HttpStatusCode.Unauthorized);
        }