public BaseRS Add(ScheduleMessage messageToBeSchedule) { BaseRS result = new BaseRS(); _scheduleMessageList.Add(messageToBeSchedule); result.Success = true; return result; }
public void DeveEnviarMensagensAgendadas() { //Arrange DeveAgendarEnvio(); MessengerService service = new MessengerService(_memoryRepository); for (int i = 0; i < 10; i++) { ScheduleMessage messageToBeScheduled = new ScheduleMessage( type: MessageType.CrossSellingHotel, emailTo: "*****@*****.**", dateToSend: DateTime.Now, externalId: i, companyId: 52 ); //Act service.DoSchedule(messageToBeScheduled); } //Act BaseRS result = service.Process().Result; //Assert Assert.IsTrue(result.Success); Assert.AreEqual(0, result.Errors.Count); //Assert }
static Task<string> PrepareTask(ScheduleMessage message) { Task<string> thread = Task.Run<string>(() => { return CallSendGridHere(message); }, _token); return thread; }
public void DeveAgendarEnvio() { //Arrange MessengerService service = new MessengerService(_memoryRepository); ScheduleMessage messageToBeScheduled = new ScheduleMessage( type: MessageType.CrossSellingHotel, emailTo: "*****@*****.**", dateToSend: DateTime.Now, externalId: 12345678, companyId: 52 ); //Act BaseRS result = service.DoSchedule(messageToBeScheduled); //Assert Assert.IsTrue(result.Success); Assert.AreEqual(0, result.Errors.Count); }
static string CallSendGridHere(ScheduleMessage message) { Thread.Sleep(1000); System.Diagnostics.Trace.WriteLine(message.ExternalId.ToString()); return message.ExternalId.ToString(); }
public BaseRS DoSchedule(ScheduleMessage messageToBeScheduled) { return _repository.Add(messageToBeScheduled); }