コード例 #1
0
 public void CountTest()
 {
     for (int y = 1900; y < 2123; y++)
     {
         var yzd = new YearlyZmanimDictionary(y, CreateZmanim(y));
         Assert.AreEqual(DateTime.IsLeapYear(y) ? 366 : 365, yzd.Count);
     }
 }
コード例 #2
0
 public void ContainsTest()
 {
     for (int y = 1900; y < 2123; y++) {
         var yzd = new YearlyZmanimDictionary(y, CreateZmanim(y));
         Assert.IsTrue(yzd.Contains(yzd.ElementAt(321)));
         Assert.IsFalse(yzd.Contains(new KeyValuePair<DateTime, ZmanimInfo>(new DateTime(y - 1, 2, 28), null)));
         Assert.IsFalse(yzd.Contains(new KeyValuePair<DateTime, ZmanimInfo>(new DateTime(y, 2, 28), null)));
     }
 }
コード例 #3
0
 public void ContainsKeyTest()
 {
     for (int y = 1900; y < 2123; y++) {
         var yzd = new YearlyZmanimDictionary(y, CreateZmanim(y));
         Assert.IsTrue(yzd.ContainsKey(new DateTime(y, 2, 28)));
         Assert.IsTrue(yzd.ContainsKey(new DateTime(y, 10, 28)));
         Assert.IsFalse(yzd.ContainsKey(new DateTime(y - 1, 2, 28)));
     }
 }
コード例 #4
0
 public void ValuesTest()
 {
     for (int y = 1900; y < 2123; y++)
     {
         var values = CreateZmanim(y);
         var yzd    = new YearlyZmanimDictionary(y, values);
         Assert.AreEqual(yzd.Values, ((IDictionary <DateTime, ZmanimInfo>)yzd).Values);
         Assert.IsTrue(values.SequenceEqual(yzd.Values));
     }
 }
コード例 #5
0
 public void ContainsTest()
 {
     for (int y = 1900; y < 2123; y++)
     {
         var yzd = new YearlyZmanimDictionary(y, CreateZmanim(y));
         Assert.IsTrue(yzd.Contains(yzd.ElementAt(321)));
         Assert.IsFalse(yzd.Contains(new KeyValuePair <DateTime, ZmanimInfo>(new DateTime(y - 1, 2, 28), null)));
         Assert.IsFalse(yzd.Contains(new KeyValuePair <DateTime, ZmanimInfo>(new DateTime(y, 2, 28), null)));
     }
 }
コード例 #6
0
 public void ContainsKeyTest()
 {
     for (int y = 1900; y < 2123; y++)
     {
         var yzd = new YearlyZmanimDictionary(y, CreateZmanim(y));
         Assert.IsTrue(yzd.ContainsKey(new DateTime(y, 2, 28)));
         Assert.IsTrue(yzd.ContainsKey(new DateTime(y, 10, 28)));
         Assert.IsFalse(yzd.ContainsKey(new DateTime(y - 1, 2, 28)));
     }
 }
コード例 #7
0
 public void ItemTest1()
 {
     for (int y = 1900; y < 2123; y++)
     {
         var values = CreateZmanim(y);
         YearlyZmanimDictionary yzd = new YearlyZmanimDictionary(y, values);
         for (int d = 0; d < values.Length; d++)
         {
             Assert.AreEqual(values[d], yzd[new DateTime(y, 1, 1).AddDays(d)]);
         }
     }
 }
コード例 #8
0
 public void TryGetValueTest()
 {
     for (int y = 1900; y < 2123; y++)
     {
         var        yzd = new YearlyZmanimDictionary(y, CreateZmanim(y));
         ZmanimInfo value;
         Assert.IsTrue(yzd.TryGetValue(new DateTime(y, 2, 28), out value));
         Assert.AreEqual(new DateTime(y, 2, 28), value.Date);
         Assert.IsFalse(yzd.TryGetValue(new DateTime(y - 1, 2, 28), out value));
         Assert.IsNull(value);
         Assert.IsTrue(yzd.TryGetValue(new DateTime(y, 10, 28), out value));
         Assert.AreEqual(new DateTime(y, 10, 28), value.Date);
     }
 }
コード例 #9
0
        public void GetEnumeratorTest()
        {
            for (int y = 1900; y < 2123; y++)
            {
                var values = CreateZmanim(y);
                YearlyZmanimDictionary yzd = new YearlyZmanimDictionary(y, values);

                var date = new DateTime(y, 1, 1);
                foreach (var kvp in yzd)
                {
                    Assert.AreEqual(date, kvp.Key);
                    Assert.AreEqual(values[date.DayOfYear - 1], kvp.Value);
                    date = date.AddDays(1);
                }
            }
        }
コード例 #10
0
        public void KeysTest()
        {
            for (int y = 1900; y < 2123; y++)
            {
                var yzd  = new YearlyZmanimDictionary(y, CreateZmanim(y));
                var keys = yzd.Keys;
                Assert.AreEqual(yzd.Count, keys.Count);
                Assert.AreEqual(DateTime.IsLeapYear(y) ? 366 : 365, keys.Count);

                var expectedDate = new DateTime(y, 1, 1);
                foreach (var date in keys)
                {
                    Assert.AreEqual(expectedDate, date);
                    expectedDate = expectedDate.AddDays(1);
                }
            }
        }
コード例 #11
0
        public void GetEnumeratorTest()
        {
            for (int y = 1900; y < 2123; y++) {
                var values = CreateZmanim(y);
                YearlyZmanimDictionary yzd = new YearlyZmanimDictionary(y, values);

                var date = new DateTime(y, 1, 1);
                foreach (var kvp in yzd) {
                    Assert.AreEqual(date, kvp.Key);
                    Assert.AreEqual(values[date.DayOfYear - 1], kvp.Value);
                    date = date.AddDays(1);
                }
            }
        }
コード例 #12
0
 public void CountTest()
 {
     for (int y = 1900; y < 2123; y++) {
         var yzd = new YearlyZmanimDictionary(y, CreateZmanim(y));
         Assert.AreEqual(DateTime.IsLeapYear(y) ? 366 : 365, yzd.Count);
     }
 }
コード例 #13
0
 public void ValuesTest()
 {
     for (int y = 1900; y < 2123; y++) {
         var values = CreateZmanim(y);
         var yzd = new YearlyZmanimDictionary(y, values);
         Assert.AreEqual(yzd.Values, ((IDictionary<DateTime, ZmanimInfo>)yzd).Values);
         Assert.IsTrue(values.SequenceEqual(yzd.Values));
     }
 }
コード例 #14
0
 public void TryGetValueTest()
 {
     for (int y = 1900; y < 2123; y++) {
         var yzd = new YearlyZmanimDictionary(y, CreateZmanim(y));
         ZmanimInfo value;
         Assert.IsTrue(yzd.TryGetValue(new DateTime(y, 2, 28), out value));
         Assert.AreEqual(new DateTime(y, 2, 28), value.Date);
         Assert.IsFalse(yzd.TryGetValue(new DateTime(y - 1, 2, 28), out value));
         Assert.IsNull(value);
         Assert.IsTrue(yzd.TryGetValue(new DateTime(y, 10, 28), out value));
         Assert.AreEqual(new DateTime(y, 10, 28), value.Date);
     }
 }
コード例 #15
0
        public void KeysTest()
        {
            for (int y = 1900; y < 2123; y++) {
                var yzd = new YearlyZmanimDictionary(y, CreateZmanim(y));
                var keys = yzd.Keys;
                Assert.AreEqual(yzd.Count, keys.Count);
                Assert.AreEqual(DateTime.IsLeapYear(y) ? 366 : 365, keys.Count);

                var expectedDate = new DateTime(y, 1, 1);
                foreach (var date in keys) {
                    Assert.AreEqual(expectedDate, date);
                    expectedDate = expectedDate.AddDays(1);
                }
            }
        }
コード例 #16
0
 public void ItemTest1()
 {
     for (int y = 1900; y < 2123; y++) {
         var values = CreateZmanim(y);
         YearlyZmanimDictionary yzd = new YearlyZmanimDictionary(y, values);
         for (int d = 0; d < values.Length; d++) {
             Assert.AreEqual(values[d], yzd[new DateTime(y, 1, 1).AddDays(d)]);
         }
     }
 }