public Task CommunicationsHouseKeepingAsync([TimerTrigger(Schedules.WeeklyTenAmSunday)] TimerInfo timerInfo, TextWriter log) { _logger.LogInformation($"Timer trigger {this.GetType().Name} fired"); var message = new CommunicationsHouseKeepingQueueMessage { CreatedByScheduleDate = _timeProvider.Now }; return(_queue.AddMessageAsync(message)); }
public async Task Delete_Communication_Messages_older_than_180_days() { //Arrange var datetime = new DateTime(2020, 08, 30).AddDays(-180); _communicationRepositoryMock.Setup(x => x.HardDelete(datetime)).Returns(Task.CompletedTask); var sut = new CommunicationsHouseKeepingQueueTrigger(_loggerMock.Object, _jobsConfig, _timeProviderMock.Object, _communicationRepositoryMock.Object); var message = new CommunicationsHouseKeepingQueueMessage() { CreatedByScheduleDate = new DateTime(2020, 08, 30) }; //Act await sut.CommunicationsHouseKeepingAsync(JsonConvert.SerializeObject(message), null); //Assert _communicationRepositoryMock.Verify(c => c.HardDelete(datetime), Times.AtLeastOnce); }