public async Task WhenPostingVacancyReadyForReReviewMessage_ThenItShouldPostAMessageWithTheNewIconAndSuitableMessage() { var vacancyReference = 1000000001; var vacancyReview = new VacancyReview { VacancyReference = vacancyReference, SubmissionCount = 2 }; var mockSlackClient = new Mock <ISlackClient>(); mockSlackClient .Setup(c => c.Post( It.Is <SlackMessage>(s => s.Text.Contains("ready for review") && s.Text.Contains(" (2nd submission)") && s.Text.Contains(vacancyReference.ToString()) ), It.Is <Emojis>(e => e.Equals(Emojis.New)))) .Returns(Task.CompletedTask) .Verifiable(); var client = new SlackNotifyVacancyReviewUpdates(mockSlackClient.Object); await client.VacancyReviewCreated(vacancyReview); mockSlackClient.Verify(); }
public async Task WhenPostingVacancyReadyForReReviewMessage_ThenItShouldPostAMessageWithTheNewIconAndSuitableMessage() { var vacancyReference = 1000000001; var vacancyReview = new VacancyReview { VacancyReference = vacancyReference, SubmissionCount = 2, VacancySnapshot = new Vacancy { OwnerType = OwnerType.Employer } }; var mockSlackClient = new Mock <ISlackClient>(); mockSlackClient .Setup(c => c.PostAsync( It.Is <SlackMessage>(s => s.Text.Contains("ready for review") && s.Text.Contains(" (2nd submission)") && s.Text.Contains(" (Employer)") && s.Text.Contains(vacancyReference.ToString()) ), It.Is <SlackVacancyNotificationType>(e => e.Equals(SlackVacancyNotificationType.New)))) .Returns(Task.CompletedTask) .Verifiable(); var client = new SlackNotifyVacancyReviewUpdates(mockSlackClient.Object, Options.Create(new SlackConfiguration())); await client.VacancyReviewCreated(vacancyReview); mockSlackClient.Verify(); }