Example #1
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;
                }
            }
        }