1 /*
2  *  "GEDKeeper", the personal genealogical database editor.
3  *  Copyright (C) 2017-2021 by Sergey V. Zhdanovskih.
4  *
5  *  This file is part of "GEDKeeper".
6  *
7  *  This program is free software: you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation, either version 3 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 using System;
22 using BSLib;
23 using GKTests;
24 using NUnit.Framework;
25 
26 namespace GKCore
27 {
28     [TestFixture]
29     public class HolidaysTests
30     {
31         private Holidays fHolidays;
32 
33         [TestFixtureSetUp]
SetUp()34         public void SetUp()
35         {
36             fHolidays = new Holidays();
37         }
38 
39         [Test]
Test_CollectTips()40         public void Test_CollectTips()
41         {
42             Assert.Throws(typeof(ArgumentNullException), () => { fHolidays.CollectTips(null); });
43 
44             using (StringList tipsList = new StringList()) {
45                 fHolidays.CollectTips(tipsList);
46                 Assert.AreEqual(0, tipsList.Count);
47 
48                 string holidaysFile = TestUtils.PrepareTestFile("test_holidays.yaml");
49                 try {
50                     fHolidays.Load(holidaysFile);
51                 } finally {
52                     TestUtils.RemoveTestFile(holidaysFile);
53                 }
54 
55                 fHolidays.CollectTips(tipsList, new DateTime(DateTime.Now.Year, 01, 05));
56                 Assert.AreEqual(2, tipsList.Count); // one for header, and one with day
57             }
58         }
59     }
60 }
61