Exemplo n.º 1
0
        public async Task UpdateRfi()
        {
            IPlanGridApi client    = PlanGridClient.Create();
            var          rfiInsert = new RfiUpsert
            {
                Question   = "test question",
                Answer     = "test answer",
                AssignedTo = new[] { TestData.ApiTestsUserUid },
                DueAt      = new DateTime(2020, 1, 1),
                IsLocked   = true,
                SentAt     = new DateTime(2019, 1, 1),
                StatusUid  = TestData.Project2DraftRfiStatusUid,
                Title      = "test title"
            };
            Rfi rfi = await client.CreateRfi(TestData.Project2Uid, rfiInsert);

            var rfiUpdate = new RfiUpsert
            {
                Question   = "test question2",
                Answer     = "test answer2",
                AssignedTo = new[] { TestData.ApiTestsUser2Uid },
                DueAt      = new DateTime(2020, 1, 2),
                IsLocked   = false,
                SentAt     = new DateTime(2019, 1, 2),
                StatusUid  = TestData.Project2OpenRfiStatusUid,
                Title      = "test title2"
            };

            rfi = await client.UpdateRfi(TestData.Project2Uid, rfi.Uid, rfiUpdate);

            Assert.AreEqual(rfiUpdate.Question, rfi.Question);
            Assert.AreEqual(rfiUpdate.Answer, rfi.Answer);
            Assert.AreEqual(rfiUpdate.AssignedTo[0], rfi.AssignedTo[0].Uid);
            Assert.AreEqual(rfiUpdate.DueAt, rfi.DueAt);
            Assert.AreEqual(rfiUpdate.IsLocked, rfi.IsLocked);
            Assert.AreEqual(rfiUpdate.SentAt, rfi.SentAt);
            Assert.AreEqual(rfiUpdate.StatusUid, rfi.Status.Uid);
            Assert.AreEqual(rfiUpdate.Title, rfi.Title);
            Assert.AreEqual(TestData.ApiTestsUserUid, rfi.CreatedBy.Uid);
            Assert.AreNotEqual(rfi.CreatedAt, default(DateTime));
            Assert.AreEqual(TestData.ApiTestsUserUid, rfi.UpdatedBy.Uid);
            Assert.AreNotEqual(rfi.UpdatedAt, default(DateTime));
        }