Example #1
0
        public async Task GetSheetsByVersionSet()
        {
            IPlanGridApi client = PlanGridClient.Create();
            Page <Sheet> sheets = await client.GetSheets(TestData.Project1Uid, version_set : TestData.Project1VersionSet1Uid);

            Assert.Less(0, sheets.Data.Length);
            Page <Sheet> sheets_empty = await client.GetSheets(TestData.Project1Uid, version_set : TestData.NotFoundUid);

            Assert.AreEqual(0, sheets_empty.Data.Length);
        }
Example #2
0
        public async Task GetSheetsObeysUpdatedAfter()
        {
            IPlanGridApi client = PlanGridClient.Create();

            Page <Sheet> sheets = await client.GetSheets(TestData.Project1Uid, updated_after : new DateTime(2015, 12, 11, 19, 38, 16, DateTimeKind.Utc));

            Assert.IsTrue(sheets.Data.Any());
            sheets = await client.GetSheets(TestData.Project1Uid, updated_after : new DateTime(2016, 12, 11, 19, 39, 16, DateTimeKind.Utc));

            Assert.IsFalse(sheets.Data.Any());
        }
Example #3
0
        public async Task GetSheetsObeysSkip()
        {
            IPlanGridApi client = PlanGridClient.Create();

            Page <Sheet> sheets = await client.GetSheets(TestData.Project1Uid);

            Assert.AreEqual("IS.1", sheets.Data[0].Name);
            Assert.AreEqual("PA8.21", sheets.Data[1].Name);
            sheets = await client.GetSheets(TestData.Project1Uid, 1);

            Assert.AreEqual("PA8.21", sheets.Data[0].Name);
        }
Example #4
0
        public async Task CreateSheetPacket()
        {
            IPlanGridApi client = PlanGridClient.Create();
            Page <Sheet> sheets = await client.GetSheets(TestData.Project2Uid);

            ShareableObject packetRequest = await client.CreateSheetPacket(TestData.Project2Uid, new SheetPacketRequest
            {
                SheetUids = new[] { sheets.Data[0].Uid }
            });

            for (int i = 0;; i++)
            {
                ShareableObject obj = await client.GetSheetPacket(TestData.Project2Uid, packetRequest.Uid);

                if (obj.Status == Status.Incomplete)
                {
                    if (i == 10)
                    {
                        Assert.Fail("Timed out after 10 seconds trying to get the packet.");
                    }
                    else
                    {
                        await Task.Delay(1000);
                    }
                }
                else
                {
                    var get = new HttpClient();
                    HttpResponseMessage response = await get.GetAsync(obj.FileUrl);

                    Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
                    break;
                }
            }
        }