public void ResendMeetingInvites_Failed_InputValidation() { MeetingInviteController classUnderTest = new MeetingInviteController(this.emailHandlerManager.Object, this.logger.Object); Task <IActionResult> res; try { res = classUnderTest.ResendMeetingInvites(null, null); } catch (Exception ex) { Assert.IsTrue(ex is ArgumentNullException); } try { res = classUnderTest.ResendMeetingInvites(this.applicationName, null); } catch (Exception ex) { Assert.IsTrue(ex is ArgumentNullException); } try { res = classUnderTest.ResendMeetingInvites(this.applicationName, new string[] { }); } catch (Exception ex) { Assert.IsTrue(ex is ArgumentNullException); } }
public void SendEmailNotificationsTestInvalidInput() { MeetingInviteController meetingInviteController = new MeetingInviteController(this.emailServiceManager.Object, this.logger); _ = Assert.ThrowsAsync <ArgumentException>(async() => await meetingInviteController.SendMeetingInvites(null, this.meetingInvitesItem)); _ = Assert.ThrowsAsync <ArgumentNullException>(async() => await meetingInviteController.SendMeetingInvites(this.applicationName, null)); }
public void ResendMeetingNotificationsByDateRangeTest_InvalidInput() { MeetingInviteController classUnderTest = new MeetingInviteController(this.emailHandlerManager.Object, this.logger.Object); _ = Assert.ThrowsAsync <ArgumentException>(async() => await classUnderTest.ResendMeetingNotificationsByDateRange(null, null)); _ = Assert.ThrowsAsync <ArgumentNullException>(async() => await classUnderTest.ResendMeetingNotificationsByDateRange(this.applicationName, null)); }
public async Task ResendEmailNotificationsByDateRangeTest_ValidInput_NoRecordToProcess() { MeetingInviteController classUnderTest = new MeetingInviteController(this.emailHandlerManager.Object, this.logger.Object); IList <NotificationResponse> responses = new List <NotificationResponse>(); var dateRange = new DateTimeRange() { StartDate = DateTime.Now, EndDate = DateTime.Now.AddHours(4), }; _ = this.emailHandlerManager .Setup(emailHandlerManager => emailHandlerManager.ResendMeetingNotificationsByDateRange(It.IsAny <string>(), It.IsAny <DateTimeRange>())) .Returns(Task.FromResult(responses)); var result = await classUnderTest.ResendMeetingNotificationsByDateRange(this.applicationName, dateRange); var res = (AcceptedResult)result; Assert.IsNotNull(res.Value); responses = null; _ = this.emailHandlerManager .Setup(emailHandlerManager => emailHandlerManager.ResendMeetingNotificationsByDateRange(It.IsAny <string>(), It.IsAny <DateTimeRange>())) .Returns(Task.FromResult(responses)); result = await classUnderTest.ResendMeetingNotificationsByDateRange(this.applicationName, dateRange); res = (AcceptedResult)result; Assert.IsNull(res.Value); }
public async Task ResendEmailNotificationsByDateRangeTest_ValidInput() { MeetingInviteController classUnderTest = new MeetingInviteController(this.emailHandlerManager.Object, this.logger.Object); IList <NotificationResponse> responses = new List <NotificationResponse>() { new NotificationResponse() { NotificationId = Guid.NewGuid().ToString(), Status = NotificationItemStatus.Queued, } }; var dateRange = new DateTimeRange() { StartDate = DateTime.Now, EndDate = DateTime.Now.AddHours(4), }; _ = this.emailHandlerManager .Setup(emailHandlerManager => emailHandlerManager.ResendMeetingNotificationsByDateRange(It.IsAny <string>(), It.IsAny <DateTimeRange>())) .Returns(Task.FromResult(responses)); var result = await classUnderTest.ResendMeetingNotificationsByDateRange(this.applicationName, dateRange); var res = (AcceptedResult)result; Assert.IsNotNull(res.Value); Assert.IsTrue(((List <NotificationResponse>)res.Value).Count == 1); }
public void ProcessQueuedEmailNotificationsTestInvalidInput() { MeetingInviteController meetingInviteController = new MeetingInviteController(this.emailServiceManager.Object, this.logger); QueueNotificationItem queueNotificationItem = new QueueNotificationItem { NotificationIds = new string[] { Guid.NewGuid().ToString() } }; _ = Assert.ThrowsAsync <ArgumentException>(async() => await meetingInviteController.ProcessQueuedMeetingNotifications(null, queueNotificationItem)); _ = Assert.ThrowsAsync <ArgumentNullException>(async() => await meetingInviteController.ProcessQueuedMeetingNotifications("TestApp", null)); }
public void ResendMeetingInvites_Success() { _ = this.emailHandlerManager.Setup(c => c.ResendNotifications(It.IsAny <string>(), It.IsAny <string[]>(), It.IsAny <NotificationType>(), It.IsAny <bool>())) .ReturnsAsync(this.GetResendMeetingInvitesResponse()); MeetingInviteController classUnderTest = new MeetingInviteController(this.emailHandlerManager.Object, this.logger.Object); var res = classUnderTest.ResendMeetingInvites(this.applicationName, this.notificationIds); Assert.AreEqual(res.Status.ToString(), "RanToCompletion"); this.emailHandlerManager.Verify(c => c.ResendNotifications(It.IsAny <string>(), It.IsAny <string[]>(), It.IsAny <NotificationType>(), It.IsAny <bool>()), Times.Once); Assert.Pass(); }
public void SendEmailNotificationsTestValidInput() { MeetingInviteController meetingInviteController = new MeetingInviteController(this.emailServiceManager.Object, this.logger); IList <NotificationResponse> responses = new List <NotificationResponse>(); _ = this.emailServiceManager .Setup(emailServiceManager => emailServiceManager.SendMeetingInvites(It.IsAny <string>(), It.IsAny <MeetingNotificationItem[]>())) .Returns(Task.FromResult(responses)); var result = meetingInviteController.SendMeetingInvites(this.applicationName, this.meetingInvitesItem); Assert.AreEqual(result.Status.ToString(), "RanToCompletion"); this.emailServiceManager.Verify(mgr => mgr.SendMeetingInvites(It.IsAny <string>(), It.IsAny <MeetingNotificationItem[]>()), Times.Once); Assert.Pass(); }
public async Task QueueMeetingNotificationsTestValidInput() { _ = this.emailHandlerManager.Setup(x => x.QueueMeetingNotifications(It.IsAny <string>(), It.IsAny <MeetingNotificationItem[]>())).ReturnsAsync(new List <NotificationResponse> { new NotificationResponse { NotificationId = "NotificationId" } }); MeetingInviteController meetinginviteController = new MeetingInviteController(this.emailHandlerManager.Object, this.mailTemplateManager.Object, this.logger); IList <NotificationResponse> responses = new List <NotificationResponse>(); var result = await meetinginviteController.QueueMeetingNotifications(this.applicationName, this.meetingNotificationItems); Assert.NotNull(result); var res = result as AcceptedResult; var items = res.Value as List <NotificationResponse>; Assert.IsTrue(items.Count == 1 && items[0].NotificationId == "NotificationId"); this.emailHandlerManager.Verify(mgr => mgr.QueueMeetingNotifications(It.IsAny <string>(), It.IsAny <MeetingNotificationItem[]>()), Times.Once); Assert.Pass(); }
public void ProcessQueuedEmailNotificationsTestValidInput() { MeetingInviteController meetingInviteController = new MeetingInviteController(this.emailServiceManager.Object, this.logger); IList <NotificationResponse> responses = new List <NotificationResponse>(); string applicationName = "TestApp"; QueueNotificationItem queueNotificationItem = new QueueNotificationItem { NotificationIds = new string[] { Guid.NewGuid().ToString() } }; _ = this.emailServiceManager .Setup(emailServiceManager => emailServiceManager.ProcessMeetingNotifications(It.IsAny <string>(), It.IsAny <QueueNotificationItem>())) .Returns(Task.FromResult(responses)); Task <IList <NotificationResponse> > result = meetingInviteController.ProcessQueuedMeetingNotifications(applicationName, queueNotificationItem); Assert.AreEqual(result.Status.ToString(), "RanToCompletion"); this.emailServiceManager.Verify(mgr => mgr.ProcessMeetingNotifications(It.IsAny <string>(), It.IsAny <QueueNotificationItem>()), Times.Once); Assert.Pass(); }