コード例 #1
0
ファイル: UnitTest1.cs プロジェクト: papsl/WordPressPCL
        public async Task CreateAndDeletePostTest()
        {
            WordPressClient client = await GetAuthenticatedWordPressClient();

            var IsValidToken = await client.IsValidJWToken();

            Assert.IsTrue(IsValidToken);
            var newpost = new PostCreate()
            {
                Content = "Testcontent"
            };
            var resultPost = await client.CreatePost(newpost);

            Assert.IsNotNull(resultPost.Id);

            var del = await client.DeletePost(resultPost.Id);

            Assert.IsTrue(del.IsSuccessStatusCode);
        }
コード例 #2
0
        public async Task CreateAndDeletePostTest()
        {
            var client = new WordPressClient(ApiCredentials.WordPressUri);

            client.Username   = ApiCredentials.Username;
            client.Password   = ApiCredentials.Password;
            client.AuthMethod = AuthMethod.JWT;
            await client.RequestJWToken();

            var IsValidToken = await client.IsValidJWToken();

            Assert.IsTrue(IsValidToken);
            var newpost = new PostCreate()
            {
                Content = "Testcontent"
            };
            var resultPost = await client.CreatePost(newpost);

            Assert.IsNotNull(resultPost.Id);

            var del = await client.DeletePost(resultPost.Id);

            Assert.IsTrue(del.IsSuccessStatusCode);
        }