示例#1
0
        public static void postsApiTest(String username, String password, String auth)
        {
            System.Diagnostics.Debug.WriteLine("\n\nSTART OF POSTSAPI TEST\n\n");
            vestorly.api.PostsApi postsApi = new vestorly.api.PostsApi();

            // GET
            vestorly.model.Posts myPosts = postsApi.FindPosts(auth, null, null, null);

            // GET{ID}
            foreach (vestorly.model.Post post in myPosts.posts)
            {
                System.Diagnostics.Debug.WriteLine("GET{ID} : " + postsApi.GetPostByID(auth, post.id));
            }

            // Post
            vestorly.model.PostInput postInput = new vestorly.model.PostInput();
            postInput.title    = "My title" + currentTime;
            postInput.postDate = "random" + currentTime;
            vestorly.model.Post mycreatedPost = postsApi.CreatePost(auth, postInput).post;
            System.Diagnostics.Debug.WriteLine("POST: " + mycreatedPost);

            // PUT
            vestorly.model.Post myPost = new vestorly.model.Post();
            myPost.title    = ("updated!!!");
            myPost.postDate = ("UPDATED!!!!");
            String postID = mycreatedPost.id;

            System.Diagnostics.Debug.WriteLine("PUT: " + postsApi.UpdatePostByID(auth, postID, myPost));
            System.Diagnostics.Debug.WriteLine("\n\nEND OF POSTSAPI TEST\n\n");
        }
示例#2
0
        public static void postsApiTest(String username, String password, String auth)
        {
            System.Diagnostics.Debug.WriteLine("\n\nSTART OF POSTSAPI TEST\n\n");
            vestorly.api.PostsApi postsApi = new vestorly.api.PostsApi();

            // GET
            vestorly.model.Posts myPosts = postsApi.FindPosts(auth, null, null, null);

            // GET{ID}
            foreach (vestorly.model.Post post in myPosts.posts)
            {
                System.Diagnostics.Debug.WriteLine("GET{ID} : " + postsApi.GetPostByID(auth, post.id));
            }

            // Post
            vestorly.model.PostInput postInput = new vestorly.model.PostInput();
            postInput.title = "My title" + currentTime;
            postInput.postDate = "random" + currentTime;
            vestorly.model.Post mycreatedPost = postsApi.CreatePost(auth, postInput).post;
            System.Diagnostics.Debug.WriteLine("POST: " + mycreatedPost);

            // PUT
            vestorly.model.Post myPost = new vestorly.model.Post();
            myPost.title = ("updated!!!");
            myPost.postDate = ("UPDATED!!!!");
            String postID = mycreatedPost.id;
            System.Diagnostics.Debug.WriteLine("PUT: " + postsApi.UpdatePostByID(auth, postID, myPost));
            System.Diagnostics.Debug.WriteLine("\n\nEND OF POSTSAPI TEST\n\n");
        }