Exemple #1
0
        public GroupConnector FromMpGroupConnector(MpGroupConnector mpGroupConnectors)
        {
            var r = mpGroupConnectors;

            return(new GroupConnector
            {
                GroupConnectorId = r.Id,
                Name = r.Name,
                PrimaryRegistraionContactId = r.PrimaryRegistrationID,
                ProjectMaximumVolunteers = r.ProjectMaximumVolunteers,
                AbsoluteMaximumVolunteers = r.AbsoluteMaximumVolunteers,
                ProjectMinimumAge = r.ProjectMinimumAge,
                ProjectType = r.ProjectType,
                PreferredLaunchSite = r.PreferredLaunchSite,
                VolunteerCount = r.VolunteerCount
            });
        }
Exemple #2
0
        public void ShouldGetProjectDetailsAndUseNickname()
        {
            const int    projectId = 564;
            const string apiToken  = "clevelandsux";

            var mpProject = new MpProject
            {
                AddressId       = 1,
                InitiativeId    = 2,
                LocationId      = 3,
                OrganizationId  = 4,
                ProjectId       = projectId,
                ProjectStatusId = 5,
                ProjectTypeId   = 6,
                ProjectName     = "Make Cleveland Great (Again?)",
                City            = "Cleveland",
                State           = "OH"
            };

            var mpGroupConnector = new MpGroupConnector
            {
                PrimaryContactId        = 234,
                PrimaryContactEmail     = "*****@*****.**",
                PrimaryContactFirstName = "Drew",
                PrimaryContactLastName  = "Carey",
                PrimaryContactNickname  = "D"
            };

            var returnVal            = new Ok <MpProject>(mpProject);
            var groupConnectorReturn = new Ok <MpGroupConnector>(mpGroupConnector);

            _apiUserRepository.Setup(m => m.GetToken()).Returns(apiToken);
            _projectRepository.Setup(m => m.GetProject(projectId, apiToken)).Returns(returnVal);
            _projectRepository.Setup(m => m.GetGroupConnector(projectId, apiToken)).Returns(groupConnectorReturn);

            var project = _fixture.GetProject(projectId);

            Assert.AreEqual(mpProject.AddressId, project.AddressId);
            Assert.AreEqual(mpProject.ProjectId, project.ProjectId);
            Assert.AreEqual("Cleveland, OH", project.Location);
            Assert.AreEqual("D Carey", project.ContactDisplayName);
            _apiUserRepository.VerifyAll();
            _projectRepository.VerifyAll();
        }
        private static GroupConnector MapGroupConnector(MpGroupConnector mpGroupConnector)
        {
            var groupConnector = new GroupConnector();

            return(mpGroupConnector != null?groupConnector.FromMpGroupConnector(mpGroupConnector) : null);
        }