protected override async Task HandleCore(CreateEventManagerInviteCommand message) { var eventManagerInvite = new EventManagerInvite { InviteeEmailAddress = message.Invite.InviteeEmailAddress, SentDateTimeUtc = DateTimeUtcNow(), CustomMessage = message.Invite.CustomMessage, SenderUserId = message.UserId, EventId = message.Invite.EventId }; _context.EventManagerInvites.Add(eventManagerInvite); await _context.SaveChangesAsync(); await _mediator.PublishAsync(new EventManagerInvited { InviteeEmail = message.Invite.InviteeEmailAddress, EventName = message.Invite.EventName, SenderName = message.SenderName, AcceptUrl = _urlHelper.Link("EventManagerInviteAcceptRoute", new { inviteId = eventManagerInvite.Id }), DeclineUrl = _urlHelper.Link("EventManagerInviteDeclineRoute", new { inviteId = eventManagerInvite.Id }), RegisterUrl = message.RegisterUrl, IsInviteeRegistered = message.IsInviteeRegistered, Message = message.Invite.CustomMessage }); }
protected override void LoadTestData() { var eventManagmentInvite = new EventManagerInvite { Id = 200, InviteeEmailAddress = "*****@*****.**", CustomMessage = "test", EventId = 2, }; Context.Campaigns.Add(new Campaign { Id = 5, Name = "testCampaign", }); Context.Events.Add(new Event { Id = 2, Name = "testEvent", CampaignId = 5, }); Context.EventManagerInvites.Add(eventManagmentInvite); Context.SaveChanges(); }
protected override async Task HandleCore(CreateEventManagerInviteCommand message) { var eventManagerInvite = new EventManagerInvite { InviteeEmailAddress = message.Invite.InviteeEmailAddress, SentDateTimeUtc = DateTimeUtcNow(), CustomMessage = message.Invite.CustomMessage, SenderUserId = message.UserId, EventId = message.Invite.EventId }; _context.EventManagerInvites.Add(eventManagerInvite); await _context.SaveChangesAsync(); }
public async Task ReturnEventManagerInvitesWithStatusRevoked_WhenInviteIsRevoked() { var query = new EventDetailQuery { EventId = _queenAnneEventId }; var handler = new EventDetailQueryHandler(Context); EventManagerInvite invite = Context.EventManagerInvites.Where(e => e.EventId == _queenAnneEventId).Single(); invite.RevokedDateTimeUtc = new DateTime(2015, 5, 29); Context.SaveChanges(); EventDetailViewModel result = await handler.Handle(query); result.EventManagerInvites.Count().ShouldBe(1); result.EventManagerInvites.Single().Id.ShouldBe(1); result.EventManagerInvites.Single().InviteeEmail.ShouldBe("*****@*****.**"); result.EventManagerInvites.Single().Status.ShouldBe(EventDetailViewModel.EventManagerInviteStatus.Revoked); }
protected override async Task HandleCore(CreateEventManagerInviteCommand message) { var @event = await _context.Events.AsNoTracking().SingleOrDefaultAsync(e => e.Id == message.Invite.EventId); if (@event == null) { throw new ArgumentException("EventId cannot be null for Event manager invite"); } var eventManagerInvite = new EventManagerInvite { InviteeEmailAddress = message.Invite.InviteeEmailAddress, SentDateTimeUtc = DateTimeUtcNow(), CustomMessage = message.Invite.CustomMessage, SenderUserId = message.UserId, Event = @event, }; _context.EventManagerInvites.Add(eventManagerInvite); await _context.SaveChangesAsync(); }