Exemplo n.º 1
0
        private static async Task ValidateIssue(Issue issue, IPlanGridApi client)
        {
            Assert.IsFalse(issue.IsDeleted);
            Assert.AreEqual(TestData.ApiTestsUserEmail, issue.AssignedTo.Single().Email);
            Assert.AreEqual(DateTime.Parse("11/16/2015 18:13:49"), issue.CreatedAt);
            Assert.AreEqual(TestData.ApiTestsUserEmail, issue.CreatedBy.Email);
            Assert.AreEqual("Test Description", issue.Description);
            Assert.AreEqual("Acoustical Ceiling", issue.Title);
            Assert.AreEqual(1, issue.Number);
            Assert.AreEqual("Test Room", issue.Room);
            Assert.AreEqual(IssueStatus.Open, issue.Status);
            Assert.AreEqual(TestData.ApiTestsUserEmail, issue.UpdatedBy.Email);
            Assert.IsFalse(string.IsNullOrEmpty(issue.Uid));
            Assert.AreEqual("01/10/2017 11:38:44.38", issue.UpdatedAt.ToString(@"MM/dd/yyyy hh\:mm\:ss\.mmm"));
            Assert.IsFalse(issue.IsDeleted);
            Assert.AreEqual("#FF0000", issue.CurrentAnnotation.Color);
            Assert.IsFalse(issue.CurrentAnnotation.IsDeleted);
            Assert.AreEqual("AC", issue.CurrentAnnotation.Stamp);
            Assert.IsFalse(string.IsNullOrEmpty(issue.CurrentAnnotation.Uid));
            Assert.AreEqual(AnnotationVisibility.Master, issue.CurrentAnnotation.Visibility);
            Assert.AreEqual(new DateTime(2020, 1, 2), issue.DueAt);
            Assert.IsTrue(issue.HasCostImpact);
            Assert.AreEqual(99999.99, issue.CostImpact);
            Assert.IsTrue(issue.HasScheduleImpact);
            Assert.AreEqual(99999999, issue.ScheduleImpactDays);

            Sheet sheet = await client.Resolve(issue.CurrentAnnotation.Sheet);

            Assert.AreEqual("AR.1", sheet.Name);
            Assert.IsFalse(sheet.IsDeleted);
            Assert.IsFalse(string.IsNullOrEmpty(sheet.Uid));
            Assert.AreEqual("Initial Set", sheet.VersionName);

            Page <Photo> photos = await client.Resolve(issue.Photos);

            Assert.AreEqual(1, photos.TotalCount);
            Assert.AreEqual(1, issue.Photos.TotalCount);
            Assert.AreEqual(DateTime.Parse("11/16/2015 18:32:43"), photos.Data[0].CreatedAt);
            Assert.AreEqual(TestData.ApiTestsUserEmail, photos.Data[0].CreatedBy.Email);
            Assert.AreEqual("Galaxy", photos.Data[0].Title);
            Assert.AreEqual(TestData.PhotoUrl, photos.Data[0].Url);
            Assert.IsFalse(string.IsNullOrEmpty(photos.Data[0].Uid));
            Assert.IsFalse(photos.Data[0].IsDeleted);

            Page <Comment> comments = await client.Resolve(issue.Comments);

            Assert.AreEqual(1, comments.TotalCount);
            Assert.AreEqual(1, issue.Comments.TotalCount);
            Assert.AreEqual(DateTime.Parse("11/16/2015 18:35:21.698"), comments.Data[0].CreatedAt);
            Assert.AreEqual(TestData.ApiTestsUserEmail, comments.Data[0].CreatedBy.Email);
            Assert.AreEqual("Test Comment", comments.Data[0].Text);
            Assert.IsFalse(string.IsNullOrEmpty(comments.Data[0].Uid));
        }
Exemplo n.º 2
0
        private async Task ValidateRfi(Rfi rfi, IPlanGridApi client)
        {
            Page <RfiChange> history = await client.GetRfiHistory(TestData.Project1Uid, rfi.Uid);

            Assert.AreEqual("locked", history.Data[0].Field);
            Assert.AreEqual(true, (bool)history.Data[0].NewValue);
            Assert.AreEqual(false, (bool)history.Data[0].OldValue);

            Assert.AreEqual("Test Rfi Answer", rfi.Answer);
            Assert.AreEqual("Test Rfi Question", rfi.Question);
            Assert.AreEqual("Test Rfi", rfi.Title);
            Assert.AreEqual(1, rfi.Number);
            Assert.AreEqual(DateTime.Parse("2015/11/18 19:30:21.000"), rfi.SentAt);
            Assert.AreEqual(DateTime.Parse("2015/11/19 19:30:13.000"), rfi.DueAt);
            Assert.AreEqual(DateTime.Parse("11/17/2015 20:06:48.115"), rfi.UpdatedAt);
            Assert.AreEqual(DateTime.Parse("11/16/2015 21:48:26.641"), rfi.CreatedAt);
            Assert.AreEqual("*****@*****.**", rfi.AssignedTo[0].Email);
            Assert.AreEqual("*****@*****.**", rfi.UpdatedBy.Email);
            Assert.AreEqual("*****@*****.**", rfi.CreatedBy.Email);
            Assert.IsFalse(string.IsNullOrEmpty(rfi.Uid));
            Assert.IsTrue(rfi.IsLocked);

            Page <Photo> photos = await client.Resolve(rfi.Photos);

            Assert.AreEqual(1, rfi.Photos.TotalCount);
            Assert.AreEqual(1, photos.TotalCount);
            Assert.AreEqual(TestData.PhotoUrl, photos.Data[0].Url);

            Page <Snapshot> snapshots = await client.Resolve(rfi.Snapshots);

            Assert.AreEqual(1, rfi.Snapshots.TotalCount);
            Assert.AreEqual(1, snapshots.TotalCount);
            Assert.AreEqual("AR.1", snapshots.Data[0].Title);

            Page <Attachment> attachments = await client.Resolve(rfi.Attachments);

            Assert.AreEqual(1, rfi.Attachments.TotalCount);
            Assert.AreEqual(1, attachments.TotalCount);
            Assert.AreEqual("PA1.11.pdf", attachments.Data[0].Name);

            Page <Comment> comments = await client.Resolve(rfi.Comments);

            Assert.AreEqual(1, rfi.Comments.TotalCount);
            Assert.AreEqual(1, comments.TotalCount);
            Assert.AreEqual("Test Rfi Comment", comments.Data[0].Text);
        }
Exemplo n.º 3
0
        private static async Task ValidateIssue(Issue issue, IPlanGridApi client)
        {
            Assert.IsFalse(issue.IsDeleted);
            Assert.AreEqual(TestData.ApiTestsUserEmail, issue.AssignedTo.Single().Email);
            Assert.AreEqual(DateTime.Parse("11/16/2015 18:13:49"), issue.CreatedAt);
            Assert.AreEqual(TestData.ApiTestsUserEmail, issue.CreatedBy.Email);
            Assert.AreEqual("Test Description", issue.Description);
            Assert.AreEqual(1, issue.Number);
            Assert.AreEqual("Test Room", issue.Room);
            Assert.AreEqual(IssueStatus.Open, issue.Status);
            Assert.AreEqual(TestData.ApiTestsUserEmail, issue.UpdatedBy.Email);
            Assert.IsFalse(string.IsNullOrEmpty(issue.Uid));
            Assert.AreEqual(DateTime.Parse("11/16/2015 18:13:50"), issue.UpdatedAt);
            Assert.IsFalse(issue.IsDeleted);
            Assert.AreEqual("#FF0000", issue.CurrentAnnotation.Color);
            Assert.IsFalse(issue.CurrentAnnotation.IsDeleted);
            Assert.AreEqual("AC", issue.CurrentAnnotation.Stamp);
            Assert.IsFalse(string.IsNullOrEmpty(issue.CurrentAnnotation.Uid));
            Assert.AreEqual(AnnotationVisibility.Master, issue.CurrentAnnotation.Visibility);

            Sheet sheet = await client.Resolve(issue.CurrentAnnotation.Sheet);
            Assert.AreEqual("AR.1", sheet.Name);
            Assert.IsFalse(sheet.IsDeleted);
            Assert.IsFalse(string.IsNullOrEmpty(sheet.Uid));
            Assert.AreEqual("Initial Set", sheet.VersionName);

            Page<Photo> photos = await client.Resolve(issue.Photos);
            Assert.AreEqual(1, photos.TotalCount);
            Assert.AreEqual(1, issue.Photos.TotalCount);
            Assert.AreEqual(DateTime.Parse("11/16/2015 18:32:43"), photos.Data[0].CreatedAt);
            Assert.AreEqual(TestData.ApiTestsUserEmail, photos.Data[0].CreatedBy.Email);
            Assert.AreEqual("Galaxy", photos.Data[0].Title);
            Assert.AreEqual(TestData.PhotoUrl, photos.Data[0].Url);
            Assert.IsFalse(string.IsNullOrEmpty(photos.Data[0].Uid));
            Assert.IsFalse(photos.Data[0].IsDeleted);

            Page<Comment> comments = await client.Resolve(issue.Comments);
            Assert.AreEqual(1, comments.TotalCount);
            Assert.AreEqual(1, issue.Comments.TotalCount);
            Assert.AreEqual(DateTime.Parse("11/16/2015 18:35:21.698"), comments.Data[0].CreatedAt);
            Assert.AreEqual(TestData.ApiTestsUserEmail, comments.Data[0].CreatedBy.Email);
            Assert.AreEqual("Test Comment", comments.Data[0].Text);
            Assert.IsFalse(string.IsNullOrEmpty(comments.Data[0].Uid));
        }
Exemplo n.º 4
0
        public async Task GetSnapshot()
        {
            IPlanGridApi client   = PlanGridClient.Create();
            Snapshot     snapshot = await client.GetSnapshot(TestData.Project1Uid, TestData.SnapshotUid);

            Assert.AreEqual("AR.1", snapshot.Title);

            Sheet sheet = await client.Resolve(snapshot.Sheet);

            Assert.AreEqual("AR.1", sheet.Name);
        }
Exemplo n.º 5
0
        private async Task ValidateRfi(Rfi rfi, IPlanGridApi client)
        {
            Page<RfiChange> history = await client.GetRfiHistory(TestData.Project1Uid, rfi.Uid);
            Assert.AreEqual("locked", history.Data[0].Field);
            Assert.AreEqual(true, (bool)history.Data[0].NewValue);
            Assert.AreEqual(false, (bool)history.Data[0].OldValue);

            Assert.AreEqual("Test Rfi Answer", rfi.Answer);
            Assert.AreEqual("Test Rfi Question", rfi.Question);
            Assert.AreEqual("Test Rfi", rfi.Title);
            Assert.AreEqual(1, rfi.Number);
            Assert.AreEqual(Date.Parse("2015-11-18"), rfi.SentDate);
            Assert.AreEqual(Date.Parse("2015-11-19"), rfi.DueDate);
            Assert.AreEqual(DateTime.Parse("11/17/2015 20:06:47.912"), rfi.UpdatedAt);
            Assert.AreEqual(DateTime.Parse("11/16/2015 21:48:26.641"), rfi.CreatedAt);
            Assert.AreEqual("*****@*****.**", rfi.AssignedTo[0].Email);
            Assert.AreEqual("*****@*****.**", rfi.UpdatedBy.Email);
            Assert.AreEqual("*****@*****.**", rfi.CreatedBy.Email);
            Assert.IsFalse(string.IsNullOrEmpty(rfi.Uid));
            Assert.IsTrue(rfi.IsLocked);

            Page<Photo> photos = await client.Resolve(rfi.Photos);
            Assert.AreEqual(1, rfi.Photos.TotalCount);
            Assert.AreEqual(1, photos.TotalCount);
            Assert.AreEqual(TestData.PhotoUrl, photos.Data[0].Url);

            Page<Snapshot> snapshots = await client.Resolve(rfi.Snapshots);
            Assert.AreEqual(1, rfi.Snapshots.TotalCount);
            Assert.AreEqual(1, snapshots.TotalCount);
            Assert.AreEqual("AR.1", snapshots.Data[0].Title);

            Page<Attachment> attachments = await client.Resolve(rfi.Attachments);
            Assert.AreEqual(1, rfi.Attachments.TotalCount);
            Assert.AreEqual(1, attachments.TotalCount);
            Assert.AreEqual("PA1.11.pdf", attachments.Data[0].Name);

            Page<Comment> comments = await client.Resolve(rfi.Comments);
            Assert.AreEqual(1, rfi.Comments.TotalCount);
            Assert.AreEqual(1, comments.TotalCount);
            Assert.AreEqual("Test Rfi Comment", comments.Data[0].Text);
        }
Exemplo n.º 6
0
        public async Task GetUser()
        {
            IPlanGridApi api  = PlanGridClient.Create();
            User         user = await api.GetUser(TestData.Project1Uid, TestData.ApiTestsUserUid);

            Assert.AreEqual(TestData.ApiTestsUserEmail, user.Email);
            Assert.IsTrue(!string.IsNullOrEmpty(user.Uid));

            Role role = await api.Resolve(user.Role);

            Assert.AreEqual("Admin", role.Label);
        }