public void CopyTest() { TimeBlock readOnlyTimeBlock = new TimeBlock( start, duration ); Assert.AreEqual( readOnlyTimeBlock.Copy( TimeSpan.Zero ), readOnlyTimeBlock ); TimeBlock timeBlock = new TimeBlock( start, duration ); Assert.AreEqual( timeBlock.Start, start ); Assert.AreEqual( timeBlock.End, end ); Assert.AreEqual( timeBlock.Duration, duration ); ITimeBlock noMoveTimeBlock = timeBlock.Copy( TimeSpan.Zero ); Assert.AreEqual( noMoveTimeBlock.Start, start ); Assert.AreEqual( noMoveTimeBlock.End, end ); Assert.AreEqual( noMoveTimeBlock.Duration, duration ); TimeSpan forwardOffset = new TimeSpan( 2, 30, 15 ); ITimeBlock forwardTimeBlock = timeBlock.Copy( forwardOffset ); Assert.AreEqual( forwardTimeBlock.Start, start.Add( forwardOffset ) ); Assert.AreEqual( forwardTimeBlock.End, end.Add( forwardOffset ) ); Assert.AreEqual( forwardTimeBlock.Duration, duration ); TimeSpan backwardOffset = new TimeSpan( -1, 10, 30 ); ITimeBlock backwardTimeBlock = timeBlock.Copy( backwardOffset ); Assert.AreEqual( backwardTimeBlock.Start, start.Add( backwardOffset ) ); Assert.AreEqual( backwardTimeBlock.End, end.Add( backwardOffset ) ); Assert.AreEqual( backwardTimeBlock.Duration, duration ); }
public void SchoolDayLessonsTest() { TimeSpan lessonDuration = Duration.Minutes( 50 ); TimeSpan shortBreakDuration = Duration.Minutes( 5 ); TimeSpan largeBreakDuration = Duration.Minutes( 15 ); DateTime now = ClockProxy.Clock.Now; DateTime todaySchoolStart = new DateTime( now.Year, now.Month, now.Day, 8, 0, 0 ); TimeBlock lesson1 = new TimeBlock( todaySchoolStart, lessonDuration ); TimeBlock break1 = new TimeBlock( lesson1.End, shortBreakDuration ); TimeBlock lesson2 = new TimeBlock( break1.End, lessonDuration ); TimeBlock break2 = new TimeBlock( lesson2.End, largeBreakDuration ); TimeBlock lesson3 = new TimeBlock( break2.End, lessonDuration ); TimeBlock break3 = new TimeBlock( lesson3.End, shortBreakDuration ); TimeBlock lesson4 = new TimeBlock( break3.End, lessonDuration ); Assert.AreEqual( lesson4.End, todaySchoolStart.Add( lessonDuration ). Add( shortBreakDuration ). Add( lessonDuration ). Add( largeBreakDuration ). Add( lessonDuration ). Add( shortBreakDuration ). Add( lessonDuration ) ); }
public void CopyConstructorTest() { TimeBlock source = new TimeBlock( start, duration ); TimeBlock copy = new TimeBlock( source ); Assert.AreEqual( source.Start, copy.Start ); Assert.AreEqual( source.End, copy.End ); Assert.AreEqual( source.Duration, copy.Duration ); Assert.AreEqual( source.IsReadOnly, copy.IsReadOnly ); Assert.AreEqual( source, copy ); }
// ---------------------------------------------------------------------- public TimeBlockPeriodRelationTestData( DateTime start, TimeSpan duration, TimeSpan offset ) { if ( offset <= TimeSpan.Zero ) { throw new ArgumentOutOfRangeException( "offset" ); } DateTime end = start.Add( duration ); Reference = new TimeBlock( start, duration, true ); DateTime beforeEnd = start.Subtract( offset ); DateTime beforeStart = beforeEnd.Subtract( Reference.Duration ); DateTime insideStart = start.Add( offset ); DateTime insideEnd = end.Subtract( offset ); DateTime afterStart = end.Add( offset ); DateTime afterEnd = afterStart.Add( Reference.Duration ); After = new TimeBlock( beforeStart, beforeEnd, true ); StartTouching = new TimeBlock( beforeStart, start, true ); StartInside = new TimeBlock( beforeStart, insideStart, true ); InsideStartTouching = new TimeBlock( start, afterStart, true ); EnclosingStartTouching = new TimeBlock( start, insideEnd, true ); Enclosing = new TimeBlock( insideStart, insideEnd, true ); EnclosingEndTouching = new TimeBlock( insideStart, end, true ); ExactMatch = new TimeBlock( start, end, true ); Inside = new TimeBlock( beforeStart, afterEnd, true ); InsideEndTouching = new TimeBlock( beforeStart, end, true ); EndInside = new TimeBlock( insideEnd, afterEnd, true ); EndTouching = new TimeBlock( end, afterEnd, true ); Before = new TimeBlock( afterStart, afterEnd, true ); allPeriods.Add( Reference ); allPeriods.Add( After ); allPeriods.Add( StartTouching ); allPeriods.Add( StartInside ); allPeriods.Add( InsideStartTouching ); allPeriods.Add( EnclosingStartTouching ); allPeriods.Add( Enclosing ); allPeriods.Add( EnclosingEndTouching ); allPeriods.Add( ExactMatch ); allPeriods.Add( Inside ); allPeriods.Add( InsideEndTouching ); allPeriods.Add( EndInside ); allPeriods.Add( EndTouching ); allPeriods.Add( Before ); }
public void NonMomentTest() { DateTime moment = ClockProxy.Clock.Now; TimeSpan delta = Duration.Millisecond; TimeBlock timeBlock = new TimeBlock( moment, moment.Add( delta ) ); Assert.IsFalse( timeBlock.IsMoment ); Assert.AreEqual( timeBlock.Duration, delta ); }
public void EndTest() { TimeBlock timeBlock = new TimeBlock( duration, end ); Assert.AreEqual( timeBlock.End, end ); Assert.AreEqual( timeBlock.Duration, duration ); DateTime changedEnd = end.AddHours( 1 ); timeBlock.End = changedEnd; Assert.AreEqual( timeBlock.End, changedEnd ); Assert.AreEqual( timeBlock.Duration, duration ); }
public static void DeckList(Client client) { client.packetMap.Remove("DeckList"); DeckList deckList = new DeckList(); foreach (KeyValuePair<string, Deck> deckServer in client.account.deckMap) { DeckList.Deck deckClient = new DeckList.Deck(); deckClient.name = deckServer.Value.name; string resources = ""; foreach (string resource in deckServer.Value.resources) { resources += resource + ","; } resources.Remove(resources.Length - 1); deckClient.resources = resources; deckClient.valid = deckServer.Value.valid; deckClient.timestamp = deckServer.Value.timestamp; DateTime dateTimeTimestamp = new DateTime(deckServer.Value.timestamp); DateTime dateTimeNow = DateTime.Now; TimeBlock timeBlock = new TimeBlock(dateTimeTimestamp, dateTimeNow); if (timeBlock.DurationDescription == String.Empty) { deckClient.updated = "A few moments ago"; } else { deckClient.updated = timeBlock.DurationDescription; } deckList.decks.Add(deckClient); } client.Send(deckList); }
public void GetIntersectionTest() { TimeBlock readOnlyTimeBlock = new TimeBlock( start, duration ); Assert.AreEqual( readOnlyTimeBlock.GetIntersection( readOnlyTimeBlock ), new TimeBlock( readOnlyTimeBlock ) ); TimeBlock timeBlock = new TimeBlock( start, duration ); // before ITimeBlock before1 = timeBlock.GetIntersection( new TimeBlock( start.AddHours( -2 ), start.AddHours( -1 ) ) ); Assert.AreEqual( before1, null ); ITimeBlock before2 = timeBlock.GetIntersection( new TimeBlock( start.AddMilliseconds( -1 ), start ) ); Assert.AreEqual( before2, new TimeBlock( start ) ); ITimeBlock before3 = timeBlock.GetIntersection( new TimeBlock( start.AddMilliseconds( -1 ), start.AddMilliseconds( 1 ) ) ); Assert.AreEqual( before3, new TimeBlock( start, start.AddMilliseconds( 1 ) ) ); // after ITimeBlock after1 = timeBlock.GetIntersection( new TimeBlock( end.AddHours( 1 ), end.AddHours( 2 ) ) ); Assert.AreEqual( after1, null ); ITimeBlock after2 = timeBlock.GetIntersection( new TimeBlock( end, end.AddMilliseconds( 1 ) ) ); Assert.AreEqual( after2, new TimeBlock( end ) ); ITimeBlock after3 = timeBlock.GetIntersection( new TimeBlock( end.AddMilliseconds( -1 ), end.AddMilliseconds( 1 ) ) ); Assert.AreEqual( after3, new TimeBlock( end.AddMilliseconds( -1 ), end ) ); // intersect Assert.AreEqual( timeBlock.GetIntersection( timeBlock ), timeBlock ); ITimeBlock itersect1 = timeBlock.GetIntersection( new TimeBlock( start.AddMilliseconds( -1 ), end.AddMilliseconds( 1 ) ) ); Assert.AreEqual( itersect1, timeBlock ); ITimeBlock itersect2 = timeBlock.GetIntersection( new TimeBlock( start.AddMilliseconds( 1 ), end.AddMilliseconds( -1 ) ) ); Assert.AreEqual( itersect2, new TimeBlock( start.AddMilliseconds( 1 ), end.AddMilliseconds( -1 ) ) ); }
public void StartTimeSpanTest() { TimeBlock timeBlock = new TimeBlock( start, duration ); Assert.AreEqual( timeBlock.Start, start ); Assert.AreEqual( timeBlock.Duration, duration ); Assert.AreEqual( timeBlock.End, end ); Assert.IsFalse( timeBlock.IsAnytime ); Assert.IsFalse( timeBlock.IsMoment ); Assert.IsFalse( timeBlock.IsReadOnly ); }
public void StartReadOnlyTest() { TimeBlock timeBlock = new TimeBlock( ClockProxy.Clock.Now, ClockProxy.Clock.Now.AddHours( 1 ), true ); timeBlock.Start = timeBlock.Start.AddHours( -1 ); }
public void SetupTest() { TimeBlock timeBlock1 = new TimeBlock(); timeBlock1.Setup( TimeSpec.MinPeriodDate, TimeSpec.MinPeriodDate ); Assert.AreEqual( timeBlock1.Start, TimeSpec.MinPeriodDate ); Assert.AreEqual( timeBlock1.End, TimeSpec.MinPeriodDate ); TimeBlock timeBlock2 = new TimeBlock(); timeBlock2.Setup( TimeSpec.MinPeriodDate, TimeSpec.MaxPeriodDate ); Assert.AreEqual( timeBlock2.Start, TimeSpec.MinPeriodDate ); Assert.AreEqual( timeBlock2.End, TimeSpec.MaxPeriodDate ); TimeBlock timeBlock3 = new TimeBlock(); timeBlock3.Setup( TimeSpec.MaxPeriodDate, TimeSpec.MinPeriodDate ); Assert.AreEqual( timeBlock3.Start, TimeSpec.MinPeriodDate ); Assert.AreEqual( timeBlock3.End, TimeSpec.MaxPeriodDate ); }
public void HasStartTest() { TimeBlock timeBlock = new TimeBlock( ClockProxy.Clock.Now, TimeSpec.MaxPeriodDate ); Assert.IsTrue( timeBlock.HasStart ); Assert.IsFalse( timeBlock.HasEnd ); }
public void HasInsidePeriodTest() { TimeBlock timeBlock = new TimeBlock( start, duration ); Assert.AreEqual( timeBlock.Duration, duration ); // before TimeBlock before1 = new TimeBlock( start.AddHours( -2 ), start.AddHours( -1 ) ); Assert.IsFalse( timeBlock.HasInside( before1 ) ); TimeBlock before2 = new TimeBlock( start.AddMilliseconds( -1 ), end ); Assert.IsFalse( timeBlock.HasInside( before2 ) ); TimeBlock before3 = new TimeBlock( start.AddMilliseconds( -1 ), start ); Assert.IsFalse( timeBlock.HasInside( before3 ) ); // after TimeBlock after1 = new TimeBlock( end.AddHours( 1 ), end.AddHours( 2 ) ); Assert.IsFalse( timeBlock.HasInside( after1 ) ); TimeBlock after2 = new TimeBlock( start, end.AddMilliseconds( 1 ) ); Assert.IsFalse( timeBlock.HasInside( after2 ) ); TimeBlock after3 = new TimeBlock( end, end.AddMilliseconds( 1 ) ); Assert.IsFalse( timeBlock.HasInside( after3 ) ); // inside Assert.IsTrue( timeBlock.HasInside( timeBlock ) ); TimeBlock inside1 = new TimeBlock( start.AddMilliseconds( 1 ), end ); Assert.IsTrue( timeBlock.HasInside( inside1 ) ); TimeBlock inside2 = new TimeBlock( start.AddMilliseconds( 1 ), end.AddMilliseconds( -1 ) ); Assert.IsTrue( timeBlock.HasInside( inside2 ) ); TimeBlock inside3 = new TimeBlock( start, end.AddMilliseconds( -1 ) ); Assert.IsTrue( timeBlock.HasInside( inside3 ) ); }
public void HasInsideDateTimeTest() { TimeBlock timeBlock = new TimeBlock( start, duration ); Assert.AreEqual( timeBlock.Duration, duration ); // start Assert.IsFalse( timeBlock.HasInside( start.AddMilliseconds( -1 ) ) ); Assert.IsTrue( timeBlock.HasInside( start ) ); Assert.IsTrue( timeBlock.HasInside( start.AddMilliseconds( 1 ) ) ); // end Assert.IsTrue( timeBlock.HasInside( end.AddMilliseconds( -1 ) ) ); Assert.IsTrue( timeBlock.HasInside( end ) ); Assert.IsFalse( timeBlock.HasInside( end.AddMilliseconds( 1 ) ) ); }
public void HasEndTest() { TimeBlock timeBlock = new TimeBlock( TimeSpec.MinPeriodDate, ClockProxy.Clock.Now ); Assert.IsFalse( timeBlock.HasStart ); Assert.IsTrue( timeBlock.HasEnd ); }
public void GetPreviousPeriodTest() { TimeBlock readOnlyTimeBlock = new TimeBlock( start, duration, true ); Assert.IsTrue( readOnlyTimeBlock.GetPreviousPeriod().IsReadOnly ); TimeBlock timeBlock = new TimeBlock( start, duration ); Assert.AreEqual( timeBlock.Start, start ); Assert.AreEqual( timeBlock.End, end ); Assert.AreEqual( timeBlock.Duration, duration ); ITimeBlock previousTimeBlock = timeBlock.GetPreviousPeriod(); Assert.AreEqual( previousTimeBlock.Start, start.Subtract( duration ) ); Assert.AreEqual( previousTimeBlock.End, start ); Assert.AreEqual( previousTimeBlock.Duration, duration ); TimeSpan previousOffset = Duration.Hour.Negate(); ITimeBlock previousOffsetTimeBlock = timeBlock.GetPreviousPeriod( previousOffset ); Assert.AreEqual( previousOffsetTimeBlock.Start, start.Subtract( duration ).Add( previousOffset ) ); Assert.AreEqual( previousOffsetTimeBlock.End, end.Subtract( duration ) .Add( previousOffset ) ); Assert.AreEqual( previousOffsetTimeBlock.Duration, duration ); }
public void GetNextPeriodTest() { TimeBlock readOnlyTimeBlock = new TimeBlock( start, duration, true ); Assert.IsTrue( readOnlyTimeBlock.GetNextPeriod().IsReadOnly ); TimeBlock timeBlock = new TimeBlock( start, duration ); Assert.AreEqual( timeBlock.Start, start ); Assert.AreEqual( timeBlock.End, end ); Assert.AreEqual( timeBlock.Duration, duration ); ITimeBlock nextTimeBlock = timeBlock.GetNextPeriod(); Assert.AreEqual( nextTimeBlock.Start, end ); Assert.AreEqual( nextTimeBlock.End, end.Add( duration ) ); Assert.AreEqual( nextTimeBlock.Duration, duration ); TimeSpan nextOffset = Duration.Hour; ITimeBlock nextOffsetTimeBlock = timeBlock.GetNextPeriod( nextOffset ); Assert.AreEqual( nextOffsetTimeBlock.Start, end.Add( nextOffset ) ); Assert.AreEqual( nextOffsetTimeBlock.End, end.Add( duration + nextOffset ) ); Assert.AreEqual( nextOffsetTimeBlock.Duration, duration ); }
public void ResetTest() { TimeBlock timeBlock = new TimeBlock( start, duration ); Assert.AreEqual( timeBlock.Start, start ); Assert.IsTrue( timeBlock.HasStart ); Assert.AreEqual( timeBlock.End, end ); Assert.IsTrue( timeBlock.HasEnd ); Assert.AreEqual( timeBlock.Duration, duration ); timeBlock.Reset(); Assert.AreEqual( timeBlock.Start, TimeSpec.MinPeriodDate ); Assert.IsFalse( timeBlock.HasStart ); Assert.AreEqual( timeBlock.End, TimeSpec.MaxPeriodDate ); Assert.IsFalse( timeBlock.HasEnd ); }
public void IntersectsWithDurationTest() { TimeBlock timeBlock = new TimeBlock( start, duration ); // before TimeBlock before1 = new TimeBlock( start.AddHours( -2 ), start.AddHours( -1 ) ); Assert.IsFalse( timeBlock.IntersectsWith( before1 ) ); TimeBlock before2 = new TimeBlock( start.AddMilliseconds( -1 ), start ); Assert.IsTrue( timeBlock.IntersectsWith( before2 ) ); TimeBlock before3 = new TimeBlock( start.AddMilliseconds( -1 ), start.AddMilliseconds( 1 ) ); Assert.IsTrue( timeBlock.IntersectsWith( before3 ) ); // after TimeBlock after1 = new TimeBlock( end.AddHours( 1 ), end.AddHours( 2 ) ); Assert.IsFalse( timeBlock.IntersectsWith( after1 ) ); TimeBlock after2 = new TimeBlock( end, end.AddMilliseconds( 1 ) ); Assert.IsTrue( timeBlock.IntersectsWith( after2 ) ); TimeBlock after3 = new TimeBlock( end.AddMilliseconds( -1 ), end.AddMilliseconds( 1 ) ); Assert.IsTrue( timeBlock.IntersectsWith( after3 ) ); // intersect Assert.IsTrue( timeBlock.IntersectsWith( timeBlock ) ); TimeBlock itersect1 = new TimeBlock( start.AddMilliseconds( -1 ), end.AddMilliseconds( 1 ) ); Assert.IsTrue( timeBlock.IntersectsWith( itersect1 ) ); TimeBlock itersect2 = new TimeBlock( start.AddMilliseconds( -1 ), start.AddMilliseconds( 1 ) ); Assert.IsTrue( timeBlock.IntersectsWith( itersect2 ) ); TimeBlock itersect3 = new TimeBlock( end.AddMilliseconds( -1 ), end.AddMilliseconds( 1 ) ); Assert.IsTrue( timeBlock.IntersectsWith( itersect3 ) ); }
public void StartEndSwapTest() { TimeBlock timeBlock = new TimeBlock( end, start ); Assert.AreEqual( timeBlock.Start, start ); Assert.AreEqual( timeBlock.Duration, duration ); Assert.AreEqual( timeBlock.End, end ); }
public void IsSamePeriodTest() { TimeBlock timeBlock1 = new TimeBlock( start, duration ); TimeBlock timeBlock2 = new TimeBlock( start, duration ); Assert.IsTrue( timeBlock1.IsSamePeriod( timeBlock1 ) ); Assert.IsTrue( timeBlock2.IsSamePeriod( timeBlock2 ) ); Assert.IsTrue( timeBlock1.IsSamePeriod( timeBlock2 ) ); Assert.IsTrue( timeBlock2.IsSamePeriod( timeBlock1 ) ); Assert.IsFalse( timeBlock1.IsSamePeriod( TimeBlock.Anytime ) ); Assert.IsFalse( timeBlock2.IsSamePeriod( TimeBlock.Anytime ) ); timeBlock1.Move( new TimeSpan( 1 ) ); Assert.IsFalse( timeBlock1.IsSamePeriod( timeBlock2 ) ); Assert.IsFalse( timeBlock2.IsSamePeriod( timeBlock1 ) ); timeBlock1.Move( new TimeSpan( -1 ) ); Assert.IsTrue( timeBlock1.IsSamePeriod( timeBlock2 ) ); Assert.IsTrue( timeBlock2.IsSamePeriod( timeBlock1 ) ); }
public void StartTest() { TimeBlock timeBlock = new TimeBlock( start, duration ); Assert.AreEqual( timeBlock.Start, start ); Assert.AreEqual( timeBlock.Duration, duration ); DateTime changedStart = start.AddHours( -1 ); timeBlock.Start = changedStart; Assert.AreEqual( timeBlock.Start, changedStart ); Assert.AreEqual( timeBlock.Duration, duration ); }
} // IsEqual // ---------------------------------------------------------------------- private bool HasSameData(TimeBlock comp) { return(start == comp.start && end == comp.end && isReadOnly == comp.isReadOnly); } // HasSameData
public void MaxDurationOutOfRangeTest() { TimeBlock timeBlock = new TimeBlock( start, duration ); timeBlock.Duration = TimeSpec.MaxPeriodDuration; }
public void EqualsTest() { TimeBlock timeBlock1 = new TimeBlock( start, duration ); TimeBlock timeBlock2 = new TimeBlock( start, duration ); Assert.IsTrue( timeBlock1.Equals( timeBlock2 ) ); TimeBlock timeBlock3 = new TimeBlock( start.AddMilliseconds( -1 ), end.AddMilliseconds( 1 ) ); Assert.IsFalse( timeBlock1.Equals( timeBlock3 ) ); }
public void TimeBlockSample() { // --- time block --- TimeBlock timeBlock = new TimeBlock( new DateTime( 2011, 2, 22, 11, 0, 0 ), new TimeSpan( 2, 0, 0 ) ); Console.WriteLine( "TimeBlock: " + timeBlock ); // > TimeBlock: 22.02.2011 11:00:00 - 13:00:00 | 02:00:00 // --- modification --- timeBlock.Start = new DateTime( 2011, 2, 22, 15, 0, 0 ); Console.WriteLine( "TimeBlock.Start: " + timeBlock ); // > TimeBlock.Start: 22.02.2011 15:00:00 - 17:00:00 | 02:00:00 timeBlock.Move( new TimeSpan( 1, 0, 0 ) ); Console.WriteLine( "TimeBlock.Move(1 hour): " + timeBlock ); // > TimeBlock.Move(1 hour): 22.02.2011 16:00:00 - 18:00:00 | 02:00:00 // --- previous/next --- Console.WriteLine( "TimeBlock.GetPreviousPeriod(): " + timeBlock.GetPreviousPeriod() ); // > TimeBlock.GetPreviousPeriod(): 22.02.2011 14:00:00 - 16:00:00 | 02:00:00 Console.WriteLine( "TimeBlock.GetNextPeriod(): " + timeBlock.GetNextPeriod() ); // > TimeBlock.GetNextPeriod(): 22.02.2011 18:00:00 - 20:00:00 | 02:00:00 Console.WriteLine( "TimeBlock.GetNextPeriod(+1 hour): " + timeBlock.GetNextPeriod( new TimeSpan( 1, 0, 0 ) ) ); // > TimeBlock.GetNextPeriod(+1 hour): 22.02.2011 19:00:00 - 21:00:00 | 02:00:00 Console.WriteLine( "TimeBlock.GetNextPeriod(-1 hour): " + timeBlock.GetNextPeriod( new TimeSpan( -1, 0, 0 ) ) ); // > TimeBlock.GetNextPeriod(-1 hour): 22.02.2011 17:00:00 - 19:00:00 | 02:00:00 }
public void MomentByPeriodTest() { TimeBlock timeBlock = new TimeBlock( ClockProxy.Clock.Now, TimeSpan.Zero ); Assert.IsTrue( timeBlock.IsMoment ); }
// ---------------------------------------------------------------------- private bool HasSameData( TimeBlock comp ) { return start == comp.start && end == comp.end && isReadOnly == comp.isReadOnly; }
public void MomentTest() { DateTime moment = ClockProxy.Clock.Now; TimeBlock timeBlock = new TimeBlock( moment ); Assert.AreEqual( timeBlock.Start, moment ); Assert.AreEqual( timeBlock.End, moment ); Assert.AreEqual( timeBlock.Duration, TimeSpec.MinPeriodDuration ); Assert.IsTrue( timeBlock.IsMoment ); }
public void MoveTest() { TimeBlock timeBlockMoveZero = new TimeBlock( start, duration ); timeBlockMoveZero.Move( TimeSpan.Zero ); Assert.AreEqual( timeBlockMoveZero.Start, start ); Assert.AreEqual( timeBlockMoveZero.End, end ); Assert.AreEqual( timeBlockMoveZero.Duration, duration ); TimeBlock timeBlockMoveForward = new TimeBlock( start, duration ); TimeSpan forwardOffset = new TimeSpan( 2, 30, 15 ); timeBlockMoveForward.Move( forwardOffset ); Assert.AreEqual( timeBlockMoveForward.Start, start.Add( forwardOffset ) ); Assert.AreEqual( timeBlockMoveForward.End, end.Add( forwardOffset ) ); TimeBlock timeBlockMoveBackward = new TimeBlock( start, duration ); TimeSpan backwardOffset = new TimeSpan( -1, 10, 30 ); timeBlockMoveBackward.Move( backwardOffset ); Assert.AreEqual( timeBlockMoveBackward.Start, start.Add( backwardOffset ) ); Assert.AreEqual( timeBlockMoveBackward.End, end.Add( backwardOffset ) ); }
public void EndReadOnlyTest() { TimeBlock timeBlock = new TimeBlock( ClockProxy.Clock.Now.AddHours( -1 ), ClockProxy.Clock.Now, true ); timeBlock.End = timeBlock.End.AddHours( 1 ); }