public void MinTest() { DateTime currentCalendarYear = TimeTool.CurrentCalendarYear; DateTime previousCalendarYear = currentCalendarYear.AddYears(-1); DateTimeSet dateTimeSet = new DateTimeSet(); Assert.AreEqual(dateTimeSet.Min, null); dateTimeSet.Add(currentCalendarYear); Assert.AreEqual(dateTimeSet.Min, currentCalendarYear); dateTimeSet.Add(previousCalendarYear); Assert.AreEqual(dateTimeSet.Min, previousCalendarYear); dateTimeSet.Clear(); Assert.AreEqual(dateTimeSet.Min, null); }
public void MaxTest() { DateTime currentCalendarYear = TimeTool.CurrentCalendarYear; DateTime nextCalendarYear = currentCalendarYear.AddYears(1); DateTimeSet dateTimeSet = new DateTimeSet(); Assert.AreEqual(dateTimeSet.Max, null); dateTimeSet.Add(currentCalendarYear); Assert.AreEqual(dateTimeSet.Max, currentCalendarYear); dateTimeSet.Add(nextCalendarYear); Assert.AreEqual(dateTimeSet.Max, nextCalendarYear); dateTimeSet.Clear(); Assert.AreEqual(dateTimeSet.Max, null); }
public void MinTest() { DateTime currentCalendarYear = Now.CalendarYear; DateTime previousCalendarYear = currentCalendarYear.AddYears(-1); DateTimeSet dateTimeSet = new DateTimeSet(); Assert.Null(dateTimeSet.Min); dateTimeSet.Add(currentCalendarYear); Assert.Equal(dateTimeSet.Min, currentCalendarYear); dateTimeSet.Add(previousCalendarYear); Assert.Equal(dateTimeSet.Min, previousCalendarYear); dateTimeSet.Clear(); Assert.Null(dateTimeSet.Min); } // MinTest
public void MaxTest() { DateTime currentCalendarYear = Now.CalendarYear; DateTime nextCalendarYear = currentCalendarYear.AddYears(1); DateTimeSet dateTimeSet = new DateTimeSet(); Assert.Null(dateTimeSet.Max); dateTimeSet.Add(currentCalendarYear); Assert.Equal(dateTimeSet.Max, currentCalendarYear); dateTimeSet.Add(nextCalendarYear); Assert.Equal(dateTimeSet.Max, nextCalendarYear); dateTimeSet.Clear(); Assert.Null(dateTimeSet.Max); } // MaxTest
public void IsAnytimeTest() { DateTimeSet dateTimeSet = new DateTimeSet(); Assert.False(dateTimeSet.IsAnytime); dateTimeSet.Add(DateTime.MinValue); Assert.False(dateTimeSet.IsAnytime); dateTimeSet.Add(DateTime.MaxValue); Assert.True(dateTimeSet.IsAnytime); dateTimeSet.Remove(DateTime.MinValue); Assert.False(dateTimeSet.IsAnytime); dateTimeSet.Clear(); Assert.False(dateTimeSet.IsAnytime); } // IsAnytimeTest
public void ClearTest() { DateTime currentCalendarYear = Now.CalendarYear; DateTime previousCalendarYear = currentCalendarYear.AddYears(-1); DateTime nextCalendarYear = currentCalendarYear.AddYears(1); DateTimeSet dateTimeSet = new DateTimeSet(); Assert.Equal(0, dateTimeSet.Count); dateTimeSet.Add(previousCalendarYear); Assert.Equal(1, dateTimeSet.Count); dateTimeSet.Add(nextCalendarYear); Assert.Equal(2, dateTimeSet.Count); dateTimeSet.Add(currentCalendarYear); Assert.Equal(3, dateTimeSet.Count); dateTimeSet.Clear(); Assert.Equal(0, dateTimeSet.Count); } // ClearTest
public void ClearTest() { DateTime currentCalendarYear = Now.CalendarYear; DateTime previousCalendarYear = currentCalendarYear.AddYears(-1); DateTime nextCalendarYear = currentCalendarYear.AddYears(1); DateTimeSet dateTimeSet = new DateTimeSet(); Assert.AreEqual(dateTimeSet.Count, 0); dateTimeSet.Add(previousCalendarYear); Assert.AreEqual(dateTimeSet.Count, 1); dateTimeSet.Add(nextCalendarYear); Assert.AreEqual(dateTimeSet.Count, 2); dateTimeSet.Add(currentCalendarYear); Assert.AreEqual(dateTimeSet.Count, 3); dateTimeSet.Clear(); Assert.AreEqual(dateTimeSet.Count, 0); } // ClearTest
public void DurationTest() { DateTime currentCalendarYear = Now.CalendarYear; DateTime nextCalendarYear = currentCalendarYear.AddYears(1); DateTimeSet dateTimeSet = new DateTimeSet(); Assert.Null(dateTimeSet.Duration); dateTimeSet.Add(currentCalendarYear); Assert.Equal(dateTimeSet.Duration, TimeSpan.Zero); dateTimeSet.Add(nextCalendarYear); Assert.Equal(dateTimeSet.Duration, nextCalendarYear - currentCalendarYear); dateTimeSet.Remove(nextCalendarYear); Assert.Equal(dateTimeSet.Duration, TimeSpan.Zero); dateTimeSet.Clear(); Assert.Null(dateTimeSet.Duration); } // DurationTest
public void IsMomentTest() { DateTime currentCalendarYear = Now.CalendarYear; DateTime nextCalendarYear = currentCalendarYear.AddYears(1); DateTimeSet dateTimeSet = new DateTimeSet(); Assert.False(dateTimeSet.IsMoment); dateTimeSet.Add(currentCalendarYear); Assert.True(dateTimeSet.IsMoment); dateTimeSet.Add(nextCalendarYear); Assert.False(dateTimeSet.IsMoment); dateTimeSet.Remove(nextCalendarYear); Assert.True(dateTimeSet.IsMoment); dateTimeSet.Clear(); Assert.False(dateTimeSet.IsMoment); } // IsMomentTest
public void IsEmptyTest() { DateTime currentCalendarYear = TimeTool.CurrentCalendarYear; DateTime nextCalendarYear = currentCalendarYear.AddYears(1); DateTimeSet dateTimeSet = new DateTimeSet(); Assert.IsTrue(dateTimeSet.IsEmpty); dateTimeSet.Add(currentCalendarYear); Assert.IsFalse(dateTimeSet.IsEmpty); dateTimeSet.Add(nextCalendarYear); Assert.IsFalse(dateTimeSet.IsEmpty); dateTimeSet.Remove(nextCalendarYear); Assert.IsFalse(dateTimeSet.IsEmpty); dateTimeSet.Clear(); Assert.IsTrue(dateTimeSet.IsEmpty); }
public void ContainsTest() { DateTime currentCalendarYear = Now.CalendarYear; DateTime previousCalendarYear = currentCalendarYear.AddYears(-1); DateTime nextCalendarYear = currentCalendarYear.AddYears(1); DateTimeSet dateTimeSet = new DateTimeSet(); Assert.False(dateTimeSet.Contains(currentCalendarYear)); Assert.False(dateTimeSet.Contains(previousCalendarYear)); Assert.False(dateTimeSet.Contains(nextCalendarYear)); dateTimeSet.Add(previousCalendarYear); Assert.False(dateTimeSet.Contains(currentCalendarYear)); Assert.True(dateTimeSet.Contains(previousCalendarYear)); Assert.False(dateTimeSet.Contains(nextCalendarYear)); dateTimeSet.Add(nextCalendarYear); Assert.False(dateTimeSet.Contains(currentCalendarYear)); Assert.True(dateTimeSet.Contains(previousCalendarYear)); Assert.True(dateTimeSet.Contains(nextCalendarYear)); dateTimeSet.Add(currentCalendarYear); Assert.True(dateTimeSet.Contains(currentCalendarYear)); Assert.True(dateTimeSet.Contains(previousCalendarYear)); Assert.True(dateTimeSet.Contains(nextCalendarYear)); dateTimeSet.Remove(nextCalendarYear); Assert.True(dateTimeSet.Contains(currentCalendarYear)); Assert.True(dateTimeSet.Contains(previousCalendarYear)); Assert.False(dateTimeSet.Contains(nextCalendarYear)); dateTimeSet.Clear(); Assert.False(dateTimeSet.Contains(currentCalendarYear)); Assert.False(dateTimeSet.Contains(previousCalendarYear)); Assert.False(dateTimeSet.Contains(nextCalendarYear)); } // ContainsTest
public void CountTest() { DateTimeSet dateTimeSet = new DateTimeSet(); Assert.AreEqual(dateTimeSet.Count, 0); dateTimeSet.Add(DateTime.MinValue); Assert.AreEqual(dateTimeSet.Count, 1); dateTimeSet.Add(DateTime.MinValue); Assert.AreEqual(dateTimeSet.Count, 1); dateTimeSet.Add(DateTime.MaxValue); Assert.AreEqual(dateTimeSet.Count, 2); dateTimeSet.Add(DateTime.MaxValue); Assert.AreEqual(dateTimeSet.Count, 2); dateTimeSet.Remove(DateTime.MinValue); Assert.AreEqual(dateTimeSet.Count, 1); dateTimeSet.Clear(); Assert.AreEqual(dateTimeSet.Count, 0); } // CountTest
public void CountTest() { DateTimeSet dateTimeSet = new DateTimeSet(); Assert.Equal(0, dateTimeSet.Count); dateTimeSet.Add(DateTime.MinValue); Assert.Equal(1, dateTimeSet.Count); dateTimeSet.Add(DateTime.MinValue); Assert.Equal(1, dateTimeSet.Count); dateTimeSet.Add(DateTime.MaxValue); Assert.Equal(2, dateTimeSet.Count); dateTimeSet.Add(DateTime.MaxValue); Assert.Equal(2, dateTimeSet.Count); dateTimeSet.Remove(DateTime.MinValue); Assert.Equal(1, dateTimeSet.Count); dateTimeSet.Clear(); Assert.Equal(0, dateTimeSet.Count); } // CountTest
public void IsEmptyTest() { DateTime currentCalendarYear = Now.CalendarYear; DateTime nextCalendarYear = currentCalendarYear.AddYears( 1 ); DateTimeSet dateTimeSet = new DateTimeSet(); Assert.IsTrue( dateTimeSet.IsEmpty ); dateTimeSet.Add( currentCalendarYear ); Assert.IsFalse( dateTimeSet.IsEmpty ); dateTimeSet.Add( nextCalendarYear ); Assert.IsFalse( dateTimeSet.IsEmpty ); dateTimeSet.Remove( nextCalendarYear ); Assert.IsFalse( dateTimeSet.IsEmpty ); dateTimeSet.Clear(); Assert.IsTrue( dateTimeSet.IsEmpty ); }
public void IsMomentTest() { DateTime currentCalendarYear = TimeTool.CurrentCalendarYear; DateTime nextCalendarYear = currentCalendarYear.AddYears(1); DateTimeSet dateTimeSet = new DateTimeSet(); Assert.IsFalse(dateTimeSet.IsMoment); dateTimeSet.Add(currentCalendarYear); Assert.IsTrue(dateTimeSet.IsMoment); dateTimeSet.Add(nextCalendarYear); Assert.IsFalse(dateTimeSet.IsMoment); dateTimeSet.Remove(nextCalendarYear); Assert.IsTrue(dateTimeSet.IsMoment); dateTimeSet.Clear(); Assert.IsFalse(dateTimeSet.IsMoment); }
public void IsAnytimeTest() { DateTimeSet dateTimeSet = new DateTimeSet(); Assert.IsFalse(dateTimeSet.IsAnytime); dateTimeSet.Add(DateTime.MinValue); Assert.IsFalse(dateTimeSet.IsAnytime); dateTimeSet.Add(DateTime.MaxValue); Assert.IsTrue(dateTimeSet.IsAnytime); dateTimeSet.Remove(DateTime.MinValue); Assert.IsFalse(dateTimeSet.IsAnytime); dateTimeSet.Clear(); Assert.IsFalse(dateTimeSet.IsAnytime); }
public void CountTest() { DateTimeSet dateTimeSet = new DateTimeSet(); Assert.AreEqual(dateTimeSet.Count, 0); dateTimeSet.Add(DateTime.MinValue); Assert.AreEqual(dateTimeSet.Count, 1); dateTimeSet.Add(DateTime.MinValue); Assert.AreEqual(dateTimeSet.Count, 1); dateTimeSet.Add(DateTime.MaxValue); Assert.AreEqual(dateTimeSet.Count, 2); dateTimeSet.Add(DateTime.MaxValue); Assert.AreEqual(dateTimeSet.Count, 2); dateTimeSet.Remove(DateTime.MinValue); Assert.AreEqual(dateTimeSet.Count, 1); dateTimeSet.Clear(); Assert.AreEqual(dateTimeSet.Count, 0); }
public void ClearTest() { DateTime currentCalendarYear = TimeTool.CurrentCalendarYear; DateTime previousCalendarYear = currentCalendarYear.AddYears(-1); DateTime nextCalendarYear = currentCalendarYear.AddYears(1); DateTimeSet dateTimeSet = new DateTimeSet(); Assert.AreEqual(dateTimeSet.Count, 0); dateTimeSet.Add(previousCalendarYear); Assert.AreEqual(dateTimeSet.Count, 1); dateTimeSet.Add(nextCalendarYear); Assert.AreEqual(dateTimeSet.Count, 2); dateTimeSet.Add(currentCalendarYear); Assert.AreEqual(dateTimeSet.Count, 3); dateTimeSet.Clear(); Assert.AreEqual(dateTimeSet.Count, 0); }
public void ContainsTest() { DateTime currentCalendarYear = TimeTool.CurrentCalendarYear; DateTime previousCalendarYear = currentCalendarYear.AddYears(-1); DateTime nextCalendarYear = currentCalendarYear.AddYears(1); DateTimeSet dateTimeSet = new DateTimeSet(); Assert.IsFalse(dateTimeSet.Contains(currentCalendarYear)); Assert.IsFalse(dateTimeSet.Contains(previousCalendarYear)); Assert.IsFalse(dateTimeSet.Contains(nextCalendarYear)); dateTimeSet.Add(previousCalendarYear); Assert.IsFalse(dateTimeSet.Contains(currentCalendarYear)); Assert.IsTrue(dateTimeSet.Contains(previousCalendarYear)); Assert.IsFalse(dateTimeSet.Contains(nextCalendarYear)); dateTimeSet.Add(nextCalendarYear); Assert.IsFalse(dateTimeSet.Contains(currentCalendarYear)); Assert.IsTrue(dateTimeSet.Contains(previousCalendarYear)); Assert.IsTrue(dateTimeSet.Contains(nextCalendarYear)); dateTimeSet.Add(currentCalendarYear); Assert.IsTrue(dateTimeSet.Contains(currentCalendarYear)); Assert.IsTrue(dateTimeSet.Contains(previousCalendarYear)); Assert.IsTrue(dateTimeSet.Contains(nextCalendarYear)); dateTimeSet.Remove(nextCalendarYear); Assert.IsTrue(dateTimeSet.Contains(currentCalendarYear)); Assert.IsTrue(dateTimeSet.Contains(previousCalendarYear)); Assert.IsFalse(dateTimeSet.Contains(nextCalendarYear)); dateTimeSet.Clear(); Assert.IsFalse(dateTimeSet.Contains(currentCalendarYear)); Assert.IsFalse(dateTimeSet.Contains(previousCalendarYear)); Assert.IsFalse(dateTimeSet.Contains(nextCalendarYear)); }
public void DurationTest() { DateTime currentCalendarYear = TimeTool.CurrentCalendarYear; DateTime nextCalendarYear = currentCalendarYear.AddYears(1); DateTimeSet dateTimeSet = new DateTimeSet(); Assert.AreEqual(dateTimeSet.Duration, null); dateTimeSet.Add(currentCalendarYear); Assert.AreEqual(dateTimeSet.Duration, TimeSpan.Zero); dateTimeSet.Add(nextCalendarYear); Assert.AreEqual(dateTimeSet.Duration, nextCalendarYear - currentCalendarYear); dateTimeSet.Remove(nextCalendarYear); Assert.AreEqual(dateTimeSet.Duration, TimeSpan.Zero); dateTimeSet.Clear(); Assert.AreEqual(dateTimeSet.Duration, null); }