コード例 #1
0
        public async Task TestThatMutationSubmitNewTopicWithInValidAuthorIdReturnsError()
        {
            string topicTitle       = "test title";
            string topicDescription = "test description";

            TopicsResponseOnError parsedResponse = await Server.CreateTopic <TopicsResponseOnError>(Guid.Empty, topicTitle, topicDescription);

            Assert.IsNotNull(parsedResponse?.Data?.SubmitTopic?.ErrorMessage, "No error message returned");
        }
コード例 #2
0
        public async Task TestThatMutationRevokeTopicWithInvalidTopicIdReturnsError()
        {
            string query = $@"mutation {{
                                revokeTopic(authorId: ""{Guid.Empty}"" topicId: ""{Guid.Empty}""){{
                                    ... on Error {{
                                        errorMessage
                                    }}
                                }}
                            }}";

            HttpResponseMessage response = await Server.PostGraphqlQuery(query);

            response.EnsureSuccessStatusCode();
            string responseString = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
            TopicsResponseOnError parsedResponse = JsonConvert.DeserializeObject <TopicsResponseOnError>(responseString);

            Assert.IsNotNull(parsedResponse?.Data?.RevokeTopic?.ErrorMessage, "No error message returned");
        }