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); } }
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))); } }
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))); } }
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)); } }
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))); } }
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)]); } } }
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); } }
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); } } }
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); } } }
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)); } }