public void FreeToPlayPeriodContainsTest() { DateTime date = DateTime.Now; FreeToPlayPeriod freeToPlayPeriod = new FreeToPlayPeriod(date, date.AddDays(1)); Assert.IsFalse(freeToPlayPeriod.Contains(freeToPlayPeriod.Begin.AddTicks(-1))); Assert.IsTrue(freeToPlayPeriod.Contains(freeToPlayPeriod.Begin)); Assert.IsTrue(freeToPlayPeriod.Contains(freeToPlayPeriod.End.AddTicks(-1))); Assert.IsFalse(freeToPlayPeriod.Contains(freeToPlayPeriod.End)); }
public void FreeToPlayPeriodIntersectsTest() { DateTime date = DateTime.Now; FreeToPlayPeriod freeToPlayPeriod = new FreeToPlayPeriod(date, date.AddDays(1)); FreeToPlayPeriod intersectingEndFreeToPlayPeriod = new FreeToPlayPeriod( freeToPlayPeriod.End.AddTicks(-1), freeToPlayPeriod.End.AddDays(1)); FreeToPlayPeriod nonIntersectingEndFreeToPlayPeriod = new FreeToPlayPeriod( freeToPlayPeriod.End, freeToPlayPeriod.End.AddDays(1)); FreeToPlayPeriod nonIntersectingBeginFreeToPlayPeriod = new FreeToPlayPeriod( freeToPlayPeriod.Begin.AddDays(-1), freeToPlayPeriod.Begin); Assert.IsTrue(freeToPlayPeriod.Intersects(intersectingEndFreeToPlayPeriod)); Assert.IsFalse(freeToPlayPeriod.Intersects(nonIntersectingEndFreeToPlayPeriod)); Assert.IsFalse(freeToPlayPeriod.Intersects(nonIntersectingBeginFreeToPlayPeriod)); }
internal FreeToPlayPeriodViewModel(FreeToPlayPeriod freeToPlayPeriod, ICryptographyService cryptographyService) { Id = cryptographyService.Encrypt(freeToPlayPeriod.Id); Begin = freeToPlayPeriod.Begin; End = freeToPlayPeriod.End; }