Пример #1
0
        public void GetParticipantByParticipantId()
        {
            const int contactId       = 99999;
            var       searchString    = $"Contact_ID_Table.[Contact_ID]={contactId}";
            var       backToTheFuture = new DateTime(2015, 10, 21);
            var       mockParticpant  = new MpParticipant
            {
                ContactId                = contactId,
                Age                      = 99,
                ParticipantId            = 100,
                EmailAddress             = "email-address",
                Nickname                 = "nick-name",
                DisplayName              = "display-name",
                ApprovedSmallGroupLeader = true,
                AttendanceStart          = backToTheFuture,
                GroupLeaderStatus        = 4
            };

            _ministryPlatformRestMock.Setup(m => m.UsingAuthenticationToken(It.IsAny <string>())).Returns(_ministryPlatformRestMock.Object);
            _ministryPlatformRestMock.Setup(m => m.Search <MpParticipant>(searchString, It.IsAny <List <string> >(), null, false)).Returns(new List <MpParticipant> {
                mockParticpant
            });

            var participant = _fixture.GetParticipant(contactId);

            Assert.IsNotNull(participant);
            Assert.AreEqual("nick-name", participant.PreferredName);
            Assert.AreEqual("email-address", participant.EmailAddress);
            Assert.AreEqual(100, participant.ParticipantId);
            Assert.IsTrue(participant.ApprovedSmallGroupLeader);
            Assert.AreEqual(backToTheFuture, participant.AttendanceStart);
        }
        public void GetParticipantByParticipantId()
        {
            const int contactId = 99999;

            const string viewKey            = "ParticipantByContactId";
            var          searchString       = contactId.ToString() + ",";
            DateTime     backToTheFuture    = new DateTime(2015, 10, 21);
            var          mockDictionaryList = new List <Dictionary <string, object> >
            {
                new Dictionary <string, object>
                {
                    { "Contact_ID", 99999 },
                    { "Participant_ID", 100 },
                    { "Email_Address", "email-address" },
                    { "Nickname", "nick-name" },
                    { "Display_Name", "display-name" },
                    { "__Age", 99 },
                    { "Approved_Small_Group_Leader", true },
                    { "Attendance_Start_Date", backToTheFuture }
                }
            };

            _mpServiceMock.Setup(m => m.GetPageViewRecords(viewKey, It.IsAny <string>(), searchString, "", 0)).Returns(mockDictionaryList);

            var participant = _fixture.GetParticipant(contactId);

            _mpServiceMock.VerifyAll();

            Assert.IsNotNull(participant);
            Assert.AreEqual("nick-name", participant.PreferredName);
            Assert.AreEqual("email-address", participant.EmailAddress);
            Assert.AreEqual(100, participant.ParticipantId);
            Assert.IsTrue(participant.ApprovedSmallGroupLeader);
            Assert.AreEqual(backToTheFuture, participant.AttendanceStart);
        }
Пример #3
0
        public void Repository_GetParticipant_Successfully()
        {
            var participant = _participants.Take(1).FirstOrDefault();

            _repo.GetParticipant(participant.Code);
        }