예제 #1
0
        public async Task TestCompletedQueryAssignments()
        {
            var assignment   = CreateSimpleAssignmentNew();
            var assignmentId = await AssignmentUtils.CreateAssignment(assignment);

            var assignmentPatch = new AssignmentPatch();

            //When we set isComplete to true, Skylight will set the completedBy field to our integration id
            assignmentPatch.Add("completedAt", DateTime.Now.ToString("yyyy-MM-dd'T'HH:mm:ss.fffzzz"));
            assignmentPatch.Add("isComplete", true);
            assignmentPatch.Add("completionDetails", "Completed by SDK");

            var assignmentPatchRequest = new PatchAssignmentRequest(assignmentPatch, assignmentId);
            await SkyManager.ApiClient.ExecuteRequestAsync(assignmentPatchRequest);

            var getAssignmentsRequest = new GetAssignmentsRequest();

            getAssignmentsRequest.AddAllRealmQuery(true);
            getAssignmentsRequest.AddCompletedQuery(true);
            getAssignmentsRequest.AddCompletedByQuery(SkyManager.IntegrationId); //As noted above, this assignment will have been completed by the integration id
            var getAssignmentsResponse = await SkyManager.ApiClient.ExecuteRequestAsync(getAssignmentsRequest);

            var queriedAssignments = getAssignmentsResponse.Content;

            //There should exist at least one assignment in the realm, as we just made one
            Assert.InRange(queriedAssignments.Count, 1, Int16.MaxValue);
            var returnedAssignment = queriedAssignments.First();

            Assert.NotNull(returnedAssignment.CompletedAt);
            Assert.Equal(returnedAssignment.CompletedBy, SkyManager.IntegrationId);
            Assert.NotNull(returnedAssignment.CompletionDetails);
            Assert.True(returnedAssignment.IsComplete);
            await AssignmentUtils.DeleteAssignment(assignmentId);
        }
예제 #2
0
        public void TestPatchAssignments()
        {
            //This exists mostly for code coverage
            var assignmentPatch = new AssignmentPatch();

            assignmentPatch.SetDefaults();
            Assert.NotNull(assignmentPatch.ToJson());
            Assert.NotNull(assignmentPatch.ToString());
        }