Exemplo n.º 1
0
        public void CreateTinyUrlTest()
        {
            NetworkFixture.MockResponse("/Create", new MockHttpResponse
            {
                Headers      = NetworkFixture.PlainText,
                ResponseBody = "tpsdb.co/short"
            });
            var shorturl = CmsData.PythonModel.CreateTinyUrl("https://status.touchpointsoftware.com");

            shorturl.ShouldBe("tpsdb.co/short");
        }
Exemplo n.º 2
0
        public void EventServiceOccurrencesTest()
        {
            NetworkFixture.MockResponse("/event/occurrences\\?endDate=2020-01-31&eventId=874491", new MockHttpResponse
            {
                Headers      = NetworkFixture.JsonHeaders,
                ResponseBody = Encoding.Default.GetString(Resources.EventServiceOccurrencesTestResponse)
            });
            var client = CreateClient();
            var list   = client.Event.Occurrences(874491, new NameValueCollection {
                { "endDate", "2020-01-31" }
            });

            list.ShouldNotBeNull();
            list.Count().ShouldBe(5);
        }
Exemplo n.º 3
0
        public void SyncWithESpaceTest()
        {
            var organization = Organization.CreateOrganization(db, 1, RandomString());

            organization.ESpaceEventId = 874491;
            db.SubmitChanges();

            var meeting = Meeting.FetchOrCreateMeeting(db, organization.OrganizationId, new DateTime(2020, 2, 20, 18, 0, 0));

            meeting.AddEditExtraText("eSPACE_ID", "7392517");
            db.SubmitChanges();

            NetworkFixture.MockResponse($"/event/occurrences\\?nextDays=60&eventId=874491", new MockHttpResponse
            {
                Headers      = NetworkFixture.JsonHeaders,
                ResponseBody = Encoding.Default.GetString(Resources.SyncWithESpaceTestResponse)
            });

            // Tests that we pulled in a new meeting
            organization.SyncWithESpace(db);
            var meetingCount = db.Meetings.Count(m => m.OrganizationId == organization.OrganizationId);

            meetingCount.ShouldBe(2);

            // Tests that we updated an existing meeting
            db.Refresh(RefreshMode.OverwriteCurrentValues, meeting);
            meeting.Location.ShouldBe("Conference Room\nE151");

            NetworkFixture.MockResponse($"/event/occurrences\\?nextDays=60&eventId=874491", new MockHttpResponse
            {
                Headers      = NetworkFixture.JsonHeaders,
                ResponseBody = Encoding.Default.GetString(Resources.SyncWithESpaceTestDeletedResponse)
            });

            // Tests that we deleted a meeting in the future that no longer has an eSpace occurrence
            meeting.MeetingDate = DateTime.Now.AddDays(30);
            db.SubmitChanges();
            organization.SyncWithESpace(db);
            meetingCount = db.Copy().Meetings.Count(m => m.OrganizationId == organization.OrganizationId);
            meetingCount.ShouldBe(1);
        }