public async void PassANotifyVolunteersCommandToTheMediatorWhenEmailIsProvided()
        {
            const int    volunteerTaskSignupId = 1001;
            const int    volunteerTaskId       = 12314;
            const string email    = "*****@*****.**";
            const string userMail = "*****@*****.**";

            var mediator = new Mock <IMediator>();

            var options = new Mock <IOptions <GeneralSettings> >();

            options.Setup(o => o.Value).Returns(new GeneralSettings {
                SiteBaseUrl = "allready.com"
            });

            var notification = new VolunteerTaskSignupStatusChanged {
                SignupId = volunteerTaskSignupId
            };

            var context             = Context;
            var volunteerTaskSignup = CreateTaskSignup(volunteerTaskSignupId, volunteerTaskId, email, userMail: userMail);

            context.VolunteerTaskSignups.Add(volunteerTaskSignup);
            context.SaveChanges();

            var target = new NotifyAdminForVolunteerTaskSignupStatusChangeHandler(context, mediator.Object, options.Object);
            await target.Handle(notification);

            mediator.VerifyAll();
        }
        public async void UsesUserFirstAndLastNameAsSubjectWhenProvided()
        {
            const int    volunteerTaskSignupId = 1001;
            const int    volunteerTaskId       = 12314;
            const string email     = "*****@*****.**";
            const string firstName = "Simon";
            const string lastName  = "Says";
            const string userEmail = "*****@*****.**";

            var mediator = new Mock <IMediator>();

            var options = new Mock <IOptions <GeneralSettings> >();

            options.Setup(o => o.Value).Returns(new GeneralSettings {
                SiteBaseUrl = "allready.com"
            });

            var notification = new VolunteerTaskSignupStatusChanged {
                SignupId = volunteerTaskSignupId
            };

            var volunteerTaskSignup = CreateTaskSignup(volunteerTaskSignupId, volunteerTaskId, email, firstName, lastName, userEmail);

            Context.VolunteerTaskSignups.Add(volunteerTaskSignup);
            Context.SaveChanges();

            var target = new NotifyAdminForVolunteerTaskSignupStatusChangeHandler(Context, mediator.Object, options.Object);
            await target.Handle(notification);

            mediator.Verify(x => x.SendAsync(It.Is <NotifyVolunteersCommand>(y => y.ViewModel.Subject == $"{firstName} {lastName}")));
        }
        public async void NotPassANotifyVolunteersCommandToTheMediatorWhenCampaignContactsIsNull()
        {
            const int volunteerTaskSignupId = 1001;
            const int volunteerTaskId       = 12314;

            var mediator = new Mock <IMediator>();
            var options  = new Mock <IOptions <GeneralSettings> >();

            var notification = new VolunteerTaskSignupStatusChanged {
                SignupId = volunteerTaskSignupId
            };

            var context             = Context;
            var volunteerTaskSignup = CreateTaskSignupWithoutCampaignContacts(volunteerTaskSignupId, volunteerTaskId);

            context.VolunteerTaskSignups.Add(volunteerTaskSignup);
            context.SaveChanges();

            var target = new NotifyAdminForVolunteerTaskSignupStatusChangeHandler(context, mediator.Object, options.Object);
            await target.Handle(notification);

            mediator.Verify(m => m.SendAsync(It.IsAny <NotifyVolunteersCommand>()), Times.Never);
        }