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 CopyTest() { TimeBlock readOnlyTimeBlock = new TimeBlock(start, duration); Assert.Equal(readOnlyTimeBlock.Copy(TimeSpan.Zero), readOnlyTimeBlock); TimeBlock timeBlock = new TimeBlock(start, duration); Assert.Equal <DateTime>(timeBlock.Start, start); Assert.Equal <DateTime>(timeBlock.End, end); Assert.Equal <TimeSpan>(timeBlock.Duration, duration); ITimeBlock noMoveTimeBlock = timeBlock.Copy(TimeSpan.Zero); Assert.Equal <DateTime>(noMoveTimeBlock.Start, start); Assert.Equal <DateTime>(noMoveTimeBlock.End, end); Assert.Equal <TimeSpan>(noMoveTimeBlock.Duration, duration); TimeSpan forwardOffset = new TimeSpan(2, 30, 15); ITimeBlock forwardTimeBlock = timeBlock.Copy(forwardOffset); Assert.Equal <DateTime>(forwardTimeBlock.Start, start.Add(forwardOffset)); Assert.Equal <DateTime>(forwardTimeBlock.End, end.Add(forwardOffset)); Assert.Equal <TimeSpan>(forwardTimeBlock.Duration, duration); TimeSpan backwardOffset = new TimeSpan(-1, 10, 30); ITimeBlock backwardTimeBlock = timeBlock.Copy(backwardOffset); Assert.Equal <DateTime>(backwardTimeBlock.Start, start.Add(backwardOffset)); Assert.Equal <DateTime>(backwardTimeBlock.End, end.Add(backwardOffset)); Assert.Equal <TimeSpan>(backwardTimeBlock.Duration, duration); } // CopyTest