public async Task Get_user_Notification_Failed() { //Arrange var userId = new Guid(); //Act var catalogContext = new NotificationsDbContext(_dbOptions); var accessServ = new NotificationsAccess(catalogContext); var NotificationServ = new NotificationsService(accessServ); var testController = new NotificationsController(NotificationServ); var actionResult = await testController.GetUserCancelledAppointmentNotification(userId).ConfigureAwait(false); //Assert Assert.IsType <NotFoundObjectResult>(actionResult); var result = ((NotFoundObjectResult)actionResult).Value; Assert.Null(result); }
public async Task Get_user_Notification_success() { //Arrange var userId = testUserId; //Act var catalogContext = new NotificationsDbContext(_dbOptions); var accessServ = new NotificationsAccess(catalogContext); var NotificationServ = new NotificationsService(accessServ); var testController = new NotificationsController(NotificationServ); var actionResult = await testController.GetUserCancelledAppointmentNotification(userId).ConfigureAwait(false); //Assert Assert.IsType <OkObjectResult>(actionResult); var result = Assert.IsAssignableFrom <List <NotificationModel> >(((OkObjectResult)actionResult).Value); Assert.Equal(3, result.Count); Assert.Equal(EventType.AppointmentCancelled.ToString(), result[0].EventType); Assert.Contains("Hi Firstname, your appointment with OrganisationName at AppointmentDateTime has been cancelled for the following reason: Reason.", result[0].Message); }