コード例 #1
0
ファイル: Apitests.cs プロジェクト: rockdreamer/ttrss-csharp
 public async Task TestUpdateArticle()
 {
     Caller api = new Caller(info);
     Assert.IsNotNull(api);
     Assert.IsFalse(api.hasSessionId);
     var heads = await api.UpdateArticle(new List<int>(new int[] { 100, 200, 130 }), Caller.UpdateArticleMode.Toggle, Caller.UpdateArticleField.Starred);
     Assert.IsTrue(api.hasSessionId);
     Assert.AreEqual(heads.Status, 0);
     Assert.AreEqual(heads.Content.Updated, 3);
     heads = await api.UpdateArticle(new List<int>(new int[] { 100, 200, 130 }), Caller.UpdateArticleMode.Toggle, Caller.UpdateArticleField.Starred);
     Assert.IsTrue(api.hasSessionId);
     Assert.AreEqual(heads.Status, 0);
     Assert.AreEqual(heads.Content.Updated, 3);
     heads = await api.UpdateArticle(new List<int>(new int[] { 100 }), Caller.UpdateArticleMode.SetFalse, Caller.UpdateArticleField.Note);
     Assert.IsTrue(api.hasSessionId);
     Assert.AreEqual(heads.Status, 0);
     heads = await api.UpdateArticle(new List<int>(new int[] { 100 }), Caller.UpdateArticleMode.SetTrue, Caller.UpdateArticleField.Note, "test-added note");
     Assert.IsTrue(api.hasSessionId);
     Assert.AreEqual(heads.Status, 0);
     Assert.AreEqual(heads.Content.Updated, 1);
     var article = await api.GetArticles(new List<int>(new int[] { 100 }));
     Assert.IsTrue(api.hasSessionId);
     Assert.AreEqual(article.Status, 0);
     Assert.AreEqual(article.Content.Length, 1);
 }