Ejemplo n.º 1
0
 public override void Dispose()
 {
     QueueServices.Clear <NotifiedAttendedEventEnd>();
     QueueServices.Clear <NotifiedSpeakersEventEnd>();
     QueueServices.Clear <AssignedBadgeToMember>();
     QueueServices.Clear <NotifiedSponsorsEventEnd>();
 }
        public async Task Add_Members_To_Badge_Add_Message_To_The_Queue()
        {
            QueueServices.Clear <AssignedBadgeToMember>();
            FillData();

            var a = await HttpClient.PostAsync($"/groupcodes/{_newGroupCode.Id}/badges/{_newBadge.Id}", null);

            var bb = await a.Content.ReadAsStringAsync();

            var message = QueueServices.GetMessage <AssignedBadgeToMember>();

            message.MemberId.Should().NotBe(0);
            message.BadgeId.Should().Be(_newBadge.Id);
            Action act = () => QueueServices.GetMessage <AssignedBadgeToMember>();

            act.Should().Throw <NullReferenceException>();

            QueueServices.Clear <AssignedBadgeToMember>();
        }
Ejemplo n.º 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();
        }