public void Arrange() { _service = new Mock <ICollectionCalendarService>(); _sut = new SetActivePeriodToInProgressCommandHandler(_service.Object); _previousCollectionPeriod = new Domain.ValueObjects.CollectionCalendarPeriod( new Domain.ValueObjects.CollectionPeriod(1, 2021), 1, 2021, DateTime.Now, DateTime.Now, false, false); _previousCollectionPeriod.SetPeriodEndInProgress(true); _activeCollectionPeriod = new Domain.ValueObjects.CollectionCalendarPeriod( new Domain.ValueObjects.CollectionPeriod(2, 2021), 1, 2021, DateTime.Now, DateTime.Now, false, false); _activeCollectionPeriod.SetActive(true); var calendarPeriods = new List <Domain.ValueObjects.CollectionCalendarPeriod> { _previousCollectionPeriod, _activeCollectionPeriod, new Domain.ValueObjects.CollectionCalendarPeriod( new Domain.ValueObjects.CollectionPeriod(3, 2021), 1, 2021, DateTime.Now, DateTime.Now, false, false) }; _collectionCalendar = new Domain.ValueObjects.CollectionCalendar(calendarPeriods); _service.Setup(x => x.Get()).ReturnsAsync(_collectionCalendar); }
internal static Domain.ValueObjects.CollectionCalendarPeriod MapCollectionCalendarPeriod(this CollectionCalendarPeriod model) { if (model != null) { var collectionCalendarPeriod = new Domain.ValueObjects.CollectionCalendarPeriod( new Domain.ValueObjects.CollectionPeriod(model.PeriodNumber, Convert.ToInt16(model.AcademicYear)), model.CalendarMonth, model.CalendarYear, model.EIScheduledOpenDateUTC, model.CensusDate, model.Active, model.PeriodEndInProgress); if (model.MonthEndProcessingCompleteUTC.HasValue) { collectionCalendarPeriod.SetMonthEndProcessingCompletedDate(model.MonthEndProcessingCompleteUTC.Value); } return(collectionCalendarPeriod); } return(null); }
private static DateTime?PaymentDate( PendingPayment pendingPayment, Payment payment, Domain.ValueObjects.CollectionCalendarPeriod nextActivePeriod) { if (payment != null) { if (payment.PaidDate != null) { return(payment.PaidDate.Value); } return(payment.CalculatedDate); } var activePeriodDate = new DateTime(nextActivePeriod.OpenDate.Year, nextActivePeriod.OpenDate.Month, nextActivePeriod.OpenDate.Day); var paymentDueDate = new DateTime(pendingPayment.DueDate.Year, pendingPayment.DueDate.Month, pendingPayment.DueDate.Day); if (paymentDueDate < activePeriodDate) { return(new DateTime(nextActivePeriod.CalendarYear, nextActivePeriod.CalendarMonth, 27)); } return(pendingPayment.DueDate.AddMonths(1)); }
public void Arrange() { var today = new DateTime(2021, 1, 30); _collectionPeriods = new List <Domain.ValueObjects.CollectionCalendarPeriod>() { new Domain.ValueObjects.CollectionCalendarPeriod( new Domain.ValueObjects.CollectionPeriod(1, (short)today.Year), (byte)today.Month, (short)today.Year, today.AddDays(-1), today.AddDays(-1), false, false), new Domain.ValueObjects.CollectionCalendarPeriod( new Domain.ValueObjects.CollectionPeriod(2, (short)today.AddMonths(1).Year), (byte)today.AddMonths(1).Month, (short)today.AddMonths(1).Year, today.AddMonths(1).AddDays(-1), today.AddMonths(1).AddDays(-1), false, false) }; _firstCollectionPeriod = _collectionPeriods.First(); _secondCollectionPeriod = _collectionPeriods.First(p => p.CollectionPeriod.PeriodNumber != _firstCollectionPeriod.CollectionPeriod.PeriodNumber); _completionDate = DateTime.UtcNow; var calendar = new Domain.ValueObjects.CollectionCalendar(_collectionPeriods); _mockCollectionCalendarService = new Mock <ICollectionCalendarService>(); _mockCollectionCalendarService .Setup(m => m.Get()) .ReturnsAsync(calendar); _sut = new CompleteCommandHandler(_mockCollectionCalendarService.Object); }