public void NextDay_test() { string quest = "暗影渦巻く壊れた世界"; DateTime d = new DateTime(2019, 8, 21); //DateTime NextAnei = new DateTime(2019, 8, 25); DateTime epc = new DateTime(2019, 8, 20); for (int i = 0; i < 30; i++) { (int day, DateTime time) = RecommendQuestCalculator.nextQuest(quest, d); int expect_day = (d - epc).Days % 5; if (expect_day != 0) { expect_day = 5 - expect_day; } DateTime expect_time = d + new TimeSpan(expect_day, 0, 0, 0); Assert.AreEqual(expect_day, day); Assert.AreEqual(expect_time, time); d += new TimeSpan(1, 0, 0, 0); } }
string postQuest(DateTime time) { string quest_name = RecommendQuestCalculator.recommandQuest(time); (int day, DateTime nextday) = RecommendQuestCalculator.nextQuest("暗影渦巻く壊れた世界", time); string postStr = string.Format("今日のおすすめクエストは{0}です。次の暗影は{1}です。", quest_name, nextday.ToString("MM月dd日")); return(postStr); }