public void 建除日Test() { LnDate date = new LnDate(2017, 2, 1); GanZhi yue = new GanZhi(date.MonthGZ); GanZhi ri = new GanZhi(date.DayGZ); JianChu jianchu = JianChu.Get(yue.Zhi, ri.Zhi); Assert.AreEqual("破日", jianchu.Name); date = new LnDate(2017, 2, 2); yue = new GanZhi(date.MonthGZ); ri = new GanZhi(date.DayGZ); jianchu = JianChu.Get(yue.Zhi, ri.Zhi); Assert.AreEqual("危日", jianchu.Name); date = new LnDate(2017, 2, 8); HuangLi hl = LnBase.黄历日(date); Assert.AreEqual("建日", hl.建除.Name); date = new LnDate(2017, 2, 9); hl = LnBase.黄历日(date); Assert.AreEqual("除日", hl.建除.Name); Assert.AreEqual(LnBase.忌日.杨公十三忌 | LnBase.忌日.岁破, hl.忌日); LnBase.忌日 jiri = LnBase.忌日.朔 | LnBase.忌日.月破; Assert.AreNotEqual(LnBase.忌日.百无禁忌, jiri & LnBase.忌日.朔); Assert.AreNotEqual(LnBase.忌日.百无禁忌, jiri & LnBase.忌日.月破); Assert.AreEqual(LnBase.忌日.百无禁忌, jiri & LnBase.忌日.杨公十三忌); }
private void Check() { GanZhi year = this.年 as GanZhi; GanZhi month = this.月 as GanZhi; GanZhi day = this.日 as GanZhi; GanZhi shi = this.时 as GanZhi; if (year != GanZhi.Zero && year.Gan.起月时(month.Zhi, 柱位.月) != month) { throw new ArgumentException($"'{year}'年不存在'{month}'月。"); } if (shi != GanZhi.Zero && day != GanZhi.Zero) { if (day.Gan.起月时(shi.Zhi, 柱位.时) != shi) { throw new ArgumentException($"'{日}'日不存在'{时}'时。"); } } }