Skip to content

Commit

Permalink
TabInformations.SubmitUpdateの通知の優先度に関するテストコードを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
upsilon committed Oct 3, 2015
1 parent 714ccf1 commit 516b09f
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions OpenTween.Tests/TabInformationTest.cs
Expand Up @@ -375,6 +375,44 @@ public void SetReadHomeTab_ContainsFilterHitTest()
Assert.Equal(150L, homeTab.OldestUnreadId);
}

[Fact]
public void SubmitUpdate_NotifyPriorityTest()
{
var homeTab = this.tabinfo.GetTabByType(MyCommon.TabUsageType.Home);
homeTab.UnreadManage = true;
homeTab.SoundFile = "home.wav";

var replyTab = this.tabinfo.GetTabByType(MyCommon.TabUsageType.Mentions);
replyTab.UnreadManage = true;
replyTab.SoundFile = "reply.wav";

var dmTab = this.tabinfo.GetTabByType(MyCommon.TabUsageType.DirectMessage);
dmTab.UnreadManage = true;
dmTab.SoundFile = "dm.wav";

// 通常ツイート
this.tabinfo.AddPost(new PostClass { StatusId = 100L, IsRead = false });

// リプライ
this.tabinfo.AddPost(new PostClass { StatusId = 200L, IsReply = true, IsRead = false });

// DM
dmTab.AddPostToInnerStorage(new PostClass { StatusId = 300L, IsDm = true, IsRead = false });

this.tabinfo.DistributePosts();

string soundFile;
PostClass[] notifyPosts;
bool isMentionIncluded, isDeletePost;
this.tabinfo.SubmitUpdate(out soundFile, out notifyPosts, out isMentionIncluded, out isDeletePost, false);

// DM が最も優先度が高いため DM の通知音が再生される
Assert.Equal("dm.wav", soundFile);

// 通知対象のツイートは 3 件
Assert.Equal(3, notifyPosts.Length);
}

class TestPostFilterRule : PostFilterRule
{
public static PostFilterRule Create(Func<PostClass, MyCommon.HITRESULT> filterDelegate)
Expand Down

0 comments on commit 516b09f

Please sign in to comment.