コード例 #1
0
ファイル: BannerTest.cs プロジェクト: mikehrod2016/bot
        public void AutoMutedWordDatatbaseIncrementTest()
        {
            const string nick      = "simpleuser";
            const string mutedWord = "mutephrase";

            InitializeDatastore.Run();
            Datastore.AddToStateString(MagicStrings.MutedWords, mutedWord, TimeSpan.FromMinutes(10).TotalSeconds, Datastore.MutedWords);

            var banner = new Banner(new PublicMessage(nick, mutedWord), null, new List <Message>());

            foreach (var i in Enumerable.Range(1, 10))
            {
                banner.BanParser(true);
                Assert.AreEqual(i, Datastore.UserHistory(nick).History[MagicStrings.MutedWords][mutedWord]);
            }

            var testMute = new Mute {
                Duration = TimeSpan.FromDays(8)
            };

            Assert.AreEqual(testMute.Duration, TimeSpan.FromDays(7));
        }