Example #1
0
        public async Task Complete_Event_Send_Material_To_Attendees()
        {
            Event eventToAdd     = FillData();
            var   memberAttended = new Member
            {
                Email = "*****@*****.**"
            };

            eventToAdd.AddAttendance(memberAttended, AttendanceRegisterType.CurrentEvent).Attend();
            Context.SaveChanges();
            var command = new CompleteEventCommand
            {
                SendMaterialToAttendees = true,
                ThanksAttendees         = true
            };
            await HttpClient.PutAsync($"/events/{eventToAdd.Id}/done",
                                      new StringContent(JsonConvert.SerializeObject(command), Encoding.UTF8, "application/json"));


            var list = QueueServices.GetMessages <NotifiedAttendedEventEnd>();

            list.Count.Should().Be(2);
            list.ToList().Any(x => x.MemberId == memberAttended.Id
                              &&
                              x.EventId == eventToAdd.Id
                              &&
                              x.SendMaterialToAttendee).Should().BeTrue();
        }
Example #2
0
        public async Task Complete_Event_Thanks_Speakers()
        {
            Event eventToAdd = FillData();

            var command = new CompleteEventCommand
            {
                ThanksSpeakers = true
            };
            var response = await HttpClient.PutAsync($"/events/{eventToAdd.Id}/done",
                                                     new StringContent(JsonConvert.SerializeObject(command), Encoding.UTF8, "application/json"));


            var list = QueueServices.GetMessages <NotifiedSpeakersEventEnd>();

            list.Count.Should().Be(1);
            list.ToList().Any(x => x.EventId == eventToAdd.Id).Should().BeTrue();
        }
Example #3
0
        public async Task Complete_Event_Assign_Badge_To_Attendees()
        {
            QueueServices.Clear <AssignedBadgeToMember>();
            Event eventToAdd = FillData();

            var badge           = new Badge();
            var memberWithBadge = new Member
            {
                Email     = "*****@*****.**",
                FirstName = "Has Badge"
            };

            eventToAdd.AddAttendance(memberWithBadge, AttendanceRegisterType.CurrentEvent).Attend();
            Context.Badges.Add(badge);
            Context.SaveChanges();

            var command = new CompleteEventCommand
            {
                GiveBadgeToAttendees = true,
                BadgeId = badge.Id
            };
            var response = await HttpClient.PutAsync($"/events/{eventToAdd.Id}/done",
                                                     new StringContent(JsonConvert.SerializeObject(command), Encoding.UTF8, "application/json"));

            RefreshContext();

            memberWithBadge = await Context.Members.Include(x => x.Badges)
                              .ThenInclude(x => x.Badge)
                              .FirstOrDefaultAsync(x => x.FirstName == memberWithBadge.FirstName);

            var list = QueueServices.GetMessages <AssignedBadgeToMember>();

            list.Count.Should().Be(2);
            list.ToList().Any(x => x.BadgeId == badge.Id
                              &&
                              x.MemberId == memberWithBadge.Id).Should().BeTrue();

            memberWithBadge.Badges.Count.Should().Be(1);
            memberWithBadge.Badges.Any(x => x.BadgeId == badge.Id).Should().BeTrue();
        }