public void TimestampAddDuration() { ITimestamp timestamp = Timestamp.Create(1234, 223); Assert.Equal(Timestamp.Create(1235, 223), timestamp.AddDuration(Duration.Create(1, 0))); Assert.Equal(Timestamp.Create(1234, 224), timestamp.AddDuration(Duration.Create(0, 1))); Assert.Equal(Timestamp.Create(1235, 224), timestamp.AddDuration(Duration.Create(1, 1))); Assert.Equal(Timestamp.Create(1236, 123), timestamp.AddDuration(Duration.Create(1, 999999900))); }
public void TimestampAddDuration_Negative() { ITimestamp timestamp = Timestamp.Create(1234, 223); Assert.Equal(Timestamp.Create(0, 0), timestamp.AddDuration(Duration.Create(-1234, -223))); Assert.Equal(Timestamp.Create(1233, 223), timestamp.AddDuration(Duration.Create(-1, 0))); Assert.Equal(Timestamp.Create(1233, 222), timestamp.AddDuration(Duration.Create(-1, -1))); Assert.Equal(Timestamp.Create(1232, 999999900), timestamp.AddDuration(Duration.Create(-1, -323))); Assert.Equal(Timestamp.Create(1200, 224), timestamp.AddDuration(Duration.Create(-33, -999999999))); }
public void AdvanceTime(IDuration duration) { lock (_lck) { currentTime = currentTime.AddDuration(duration); } }