public void CreateOrDismissMBovisAlert(string drugSpecies, bool shouldCreateAlert, bool shouldDismissAlert) { // Arrange var notification = new Notification { NotificationId = 1, DrugResistanceProfile = new DrugResistanceProfile { Species = drugSpecies, DrugResistanceProfileString = "Random string" } }; // Act EnhancedSurveillanceAlertsService.CreateOrDismissMBovisAlert(notification); // Assert var numberOfCallsToCreate = shouldCreateAlert ? Times.Once() : Times.Never(); mockAlertService.Verify(x => x.AddUniqueAlertAsync(It.IsAny <MBovisAlert>()), numberOfCallsToCreate); var numberOfCallsToDismiss = shouldDismissAlert ? Times.Once() : Times.Never(); mockAlertService.Verify( x => x.DismissMatchingAlertAsync <MBovisAlert>(notification.NotificationId, AuditService.AuditUserSystem), numberOfCallsToDismiss); }
public async Task CreateOrDismissMBovisAlert(string drugSpecies, bool notificationClosed, Status?hasExposureToKnownCases, Status?hasUnpasteurisedMilkConsumption, Status?hasOccupationExposure, Status?hasAnimalExposure, bool shouldCreateAlert, bool shouldDismissAlert) { // Arrange var notification = new Notification { NotificationId = 1, NotificationStatus = notificationClosed ? NotificationStatus.Closed : NotificationStatus.Notified, DrugResistanceProfile = new DrugResistanceProfile { Species = drugSpecies, DrugResistanceProfileString = "Random string", }, MBovisDetails = new MBovisDetails { ExposureToKnownCasesStatus = hasExposureToKnownCases, UnpasteurisedMilkConsumptionStatus = hasUnpasteurisedMilkConsumption, OccupationExposureStatus = hasOccupationExposure, AnimalExposureStatus = hasAnimalExposure, } }; // Act await EnhancedSurveillanceAlertsService.CreateOrDismissMBovisAlert(notification); // Assert var numberOfCallsToCreate = shouldCreateAlert ? Times.Once() : Times.Never(); mockAlertService.Verify(x => x.AddUniqueAlertAsync(It.IsAny <MBovisAlert>()), numberOfCallsToCreate); var numberOfCallsToDismiss = shouldDismissAlert ? Times.Once() : Times.Never(); mockAlertService.Verify( x => x.DismissMatchingAlertAsync <MBovisAlert>(notification.NotificationId, AuditService.AuditUserSystem), numberOfCallsToDismiss); }