{"id":26598,"date":"2020-07-01T00:00:00","date_gmt":"2020-06-30T22:00:00","guid":{"rendered":"https:\/\/blexin.com\/testiamo-la-nostra-api-con-graphql-e-hot-chocolate\/"},"modified":"2021-05-20T18:25:02","modified_gmt":"2021-05-20T16:25:02","slug":"testing-our-api-with-graphql-and-hot-chocolate","status":"publish","type":"post","link":"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/","title":{"rendered":"Testing our API with GraphQL and Hot Chocolate"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"608\" data-attachment-id=\"26574\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/attachment\/f05eb91a-2779-4926-9141-5f41a88a81d3-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/f05eb91a-2779-4926-9141-5f41a88a81d3.png?fit=1024%2C608&amp;ssl=1\" data-orig-size=\"1024,608\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"f05eb91a-2779-4926-9141-5f41a88a81d3\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/f05eb91a-2779-4926-9141-5f41a88a81d3.png?fit=1024%2C608&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/f05eb91a-2779-4926-9141-5f41a88a81d3.png?resize=1024%2C608&#038;ssl=1\" alt=\"\" class=\"wp-image-26574\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/f05eb91a-2779-4926-9141-5f41a88a81d3.png 1024w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/f05eb91a-2779-4926-9141-5f41a88a81d3-980x582.png 980w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/f05eb91a-2779-4926-9141-5f41a88a81d3-480x285.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In<a href=\"https:\/\/www.blexin.com\/en-US\/Article\/Blog\/Creating-our-API-with-GraphQL-and-Hot-Chocolate-79\" target=\"_blank\" rel=\"noreferrer noopener\">&nbsp;my previous article<\/a>. i showed what GraphQL is and how we can create an API with HotChocolate. Starting from the code on my repo&nbsp;<a href=\"https:\/\/github.com\/AARNOLD87\/GraphQLWithHotChocolate\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/AARNOLD87\/GraphQLWithHotChocolate<\/a>&nbsp;let\u2019s see how we can test the project.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is not a unit test, because we are not going to test the service or the gateway, but we are going to carry out the integration tests. These tests will help you understand if the whole flow, from input to response, is working properly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I used these test to make also sure my API provided all the required data. It is true that. using GraphQL, the user specifies which data he wants to receive, but it is also true that, if those data have not been predicted, they can never be provided as an answer. In fact, the user can only request a subset of the data displayed from the API. After cloning the repo, we add a new project Nunit Test Project (.Net Core) to the solution :<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"943\" height=\"652\" data-attachment-id=\"26576\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/attachment\/image1-1-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image1-1.png?fit=943%2C652&amp;ssl=1\" data-orig-size=\"943,652\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image1-1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image1-1.png?fit=943%2C652&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image1-1.png?resize=943%2C652&#038;ssl=1\" alt=\"\" class=\"wp-image-26576\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image1-1.png 943w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image1-1-480x332.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 943px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">That project already has&nbsp;the NuGet package of&nbsp;<strong>Nunit, Nunit3TestAdapter and Microsoft.NET.Test.Sdk<\/strong>, that we need in order to create and perform tests.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We also add&nbsp;<strong>Microsoft.AspNetCore.Mvc.Core.&nbsp;<\/strong>Let\u2019s make sure we have installed everything correctly by running the test created by the template.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"486\" height=\"242\" data-attachment-id=\"26579\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/attachment\/image2-1-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image2-1.png?fit=486%2C242&amp;ssl=1\" data-orig-size=\"486,242\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image2-1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image2-1.png?fit=486%2C242&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image2-1.png?resize=486%2C242&#038;ssl=1\" alt=\"\" class=\"wp-image-26579\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image2-1.png 486w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image2-1-480x239.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 486px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now that we have set it up, we can create classes that test our GraphQL queries.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s create a class that tests the query on the books. Let\u2019s create&nbsp;<strong>BookQueryTest<\/strong>&nbsp;class with the&nbsp;<strong>ShouldReturnBooks<\/strong>&nbsp;method, in which we want to test that GraphQL correctly manages the following query.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nquery {\n\u00a0\u00a0\u00a0\u00a0books {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0nodes {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0id\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0title\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0price\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0}\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">HotChocolate provides a&nbsp;<strong>QueryExecutor<\/strong>, which returns the result of the execution in view of query request. So if in our test we do the setup of the IoC container, we can then ask the&nbsp;<strong>ServiceProvider<\/strong>&nbsp;to return an instance of&nbsp;<strong>IQueryExecuter<\/strong>. A possible solution could be to create a specific IoC container for the testing in which to record mock implementations for the respective interfaces, but i preferred to use the same IoC engine as the application.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nIServiceCollection services = new ServiceCollection();\nvar startup = new Startup();\nstartup.ConfigureServices(services);\nvar provider = services.BuildServiceProvider();\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">At this point we can ask the provider to return an instance of&nbsp;<strong>IQueryExecutor<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nvar executor = provider.GetService&lt;IQueryExecutor&gt;();\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s build the request:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nIReadOnlyQueryRequest request =\n\u00a0\u00a0\u00a0\u00a0QueryRequestBuilder.New()\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.SetQuery(BooksQuery)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.SetServices(provider)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.Create();\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">In this case,&nbsp;<strong>BooksQuery<\/strong>&nbsp;is the query that we want to test. The&nbsp;<em>arrange<\/em>&nbsp;phase is over, we can pass our request to the executor for&nbsp;<em>act<\/em>&nbsp;phase.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nIExecutionResult result = await executor.ExecuteAsync(request);\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">In order to make the appropriate&nbsp;<em>asserts<\/em>, we must make the&nbsp;<strong>result<\/strong>&nbsp;more readable.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">HotChocolate provides an extension method that turns result in a JSON.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nvar resultJson = result.ToJson();\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>ResultJson<\/strong>&nbsp;is readable but it is still difficult to make one or more&nbsp;<em>asserts<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We can use&nbsp;<strong>ApprovalTests<\/strong>: it is a library that saves a file in our project and then will hold it as a sample to compare with the subsequent test results.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s add it to the test project through NuGet.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Our&nbsp;<em>assert<\/em>&nbsp;will be:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nApprovals.Verify(resultJson);\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s add the following annotation to the class, as described in the documentation:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n&#x5B;UseReporter(typeof(DiffReporter))]\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">This annotation will allow the library to pinpoint the type of comparison itl needs to make when we invoke the Verify method. We are ready to launch our test and, if all end well, we will have a red test:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"797\" height=\"308\" data-attachment-id=\"26584\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/attachment\/image3-1-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image3-1.png?fit=797%2C308&amp;ssl=1\" data-orig-size=\"797,308\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image3-1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image3-1.png?fit=797%2C308&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image3-1.png?resize=797%2C308&#038;ssl=1\" alt=\"\" class=\"wp-image-26584\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image3-1.png 797w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image3-1-480x185.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 797px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Looking among the files of the solution, we can see that new file has been added<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>BookQueryTest.ShouldReturnBooks.received.txt<\/em>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"654\" height=\"148\" data-attachment-id=\"26586\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/attachment\/image4-1-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image4-1.png?fit=654%2C148&amp;ssl=1\" data-orig-size=\"654,148\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image4-1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image4-1.png?fit=654%2C148&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image4-1.png?resize=654%2C148&#038;ssl=1\" alt=\"\" class=\"wp-image-26586\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image4-1.png 654w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image4-1-480x109.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 654px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Within this file we will find the result of the execution of the query:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n{\n  &quot;data&quot;: {\n    &quot;books&quot;: {\n      &quot;nodes&quot;: &#x5B;\n        {\n          &quot;id&quot;: &quot;1&quot;,\n          &quot;title&quot;: &quot;First Book&quot;,\n          &quot;price&quot;: 10.0\n        },\n        {\n          &quot;id&quot;: &quot;2&quot;,\n          &quot;title&quot;: &quot;Second Book&quot;,\n          &quot;price&quot;: 11.0\n        },\n        {\n          &quot;id&quot;: &quot;3&quot;,\n          &quot;title&quot;: &quot;Third Book&quot;,\n          &quot;price&quot;: 12.0\n        },\n        {\n          &quot;id&quot;: &quot;4&quot;,\n          &quot;title&quot;: &quot;Fourth Book&quot;,\n          &quot;price&quot;: 15.0\n        }\n      ]\n    }\n  }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Perfect, it is as expected. We rename the file replacing&nbsp;<strong><em>received<\/em><\/strong>&nbsp;with&nbsp;<strong><em>approved<\/em><\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"663\" height=\"139\" data-attachment-id=\"26589\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/attachment\/image5-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image5.png?fit=663%2C139&amp;ssl=1\" data-orig-size=\"663,139\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image5\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image5.png?fit=663%2C139&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image5.png?resize=663%2C139&#038;ssl=1\" alt=\"\" class=\"wp-image-26589\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image5.png 663w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image5-480x101.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 663px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Running the test again:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"266\" data-attachment-id=\"26591\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/attachment\/image6-1-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image6-1.png?fit=802%2C266&amp;ssl=1\" data-orig-size=\"802,266\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image6-1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image6-1.png?fit=802%2C266&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image6-1.png?resize=802%2C266&#038;ssl=1\" alt=\"\" class=\"wp-image-26591\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image6-1.png 802w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image6-1-480x159.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 802px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">It&#8217;s green, excellent. Now we must test the&nbsp;<em>mutations<\/em>, creating a test that verifies the creation of a book. Let\u2019s add the class&nbsp;<strong>CreateBookMutationTest<\/strong>&nbsp;to the project, and create the method&nbsp;<strong>ShouldCreateBook<\/strong>inside it. The steps to take are exactly those of the previous test, we will change only the query that we will pass to the&nbsp;<em>QueryRequestBuild<\/em>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nmutation {\n\u00a0\u00a0\u00a0\u00a0createBook(inputBook: {authorId: 4, price:50, title:&quot;&quot;Test book&quot;&quot;}) {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0price\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0title\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0authorId\n\u00a0\u00a0\u00a0\u00a0}\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">If we start the test, it will fail again. Asking to specify the reference file, we check that&nbsp;<em>CreateBookMutationTest.ShouldCreateBook.received.txt<\/em>&nbsp;contains the expected values:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n{\n    &quot;data&quot;: {\n        &quot;createBook&quot;: {\n            &quot;price&quot;: 50.0,\n             &quot;title&quot;: &quot;Test book&quot;,\n             &quot;authorId&quot;: 4\n        }\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">We rename the file as we did before, and we run the test again: if everything goes as planned it will be green!<br>You can pass parameters to the query, so that you don\u2019t have the default input values.<br>We try to apply this method to the query&nbsp;<em>CreateBook:<\/em>&nbsp;the purpose is not to have the author id, the price and the title already in the query, but we want it to be passed every time in the phase of creation request.<br>This has a fundamental advantage, that is being able to test the query with different inputs modifying only the past values.<br>Here is how the&nbsp;<em>CreateBook<\/em>&nbsp;query changes<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nmutation($title: String, $price: Decimal!, $authorId: Int!) {\n\u00a0\u00a0\u00a0\u00a0createBook(inputBook: {authorId: $authorId, price:$price, title:$title}) {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0price\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0title\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0authorId\n\u00a0\u00a0\u00a0}\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Input parameters must be declared immediately after the keyword&nbsp;<em>mutation&nbsp;<\/em>and then where we want them to be used. In addition to the parameter name, the type should be specified, while the exclamation mark indicates that it is a mandatory parameter.<br>Now all that remains is to specify them in the&nbsp;<em>QueryRequestBuilder<\/em>&nbsp;using the&nbsp;<strong><em>AddVariableValue<\/em><\/strong>&nbsp;method<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nIReadOnlyQueryRequest request =\n\u00a0\u00a0\u00a0\u00a0QueryRequestBuilder.New()\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.SetQuery(CreateBookQuery)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.SetServices(provider)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.AddVariableValue(&quot;title&quot;, &quot;Test book&quot;)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.AddVariableValue(&quot;authorId&quot;, 4)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.AddVariableValue(&quot;price&quot;, 50.0)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.Create();\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">We have seen the two possible cases. Other queries and mutations exposed by the API must be tested exactly in the same way. In a more complex project, the&nbsp;<em>arrange<\/em>&nbsp;section could be more complex, and not only creating the IoC container but also a specific data to verify the correctness of information recovery queries.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Act<\/em>&nbsp;and&nbsp;<em>Assert<\/em>, however, may continue to remain the same.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I hope I intrigued you.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">See you at the next article!<\/p>\n\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>GraphQL: let\u2019s see how we can test queries and mutation in ASP.NET Core with Hot Chocolate<\/p>\n","protected":false},"author":196716250,"featured_media":26574,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","inline_featured_image":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_wpcom_ai_launchpad_first_post":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"{title}\n\n{excerpt}\n\n{url}","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_wpas_customize_per_network":false,"jetpack_post_was_ever_published":false},"categories":[688637524],"tags":[688637416,688637384,688637417,688637411],"class_list":["post-26598","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog-en","tag-asp-net-core-en","tag-c-en","tag-graphql-en","tag-testing-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Testing our API with GraphQL and Hot Chocolate - Blexin<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Testing our API with GraphQL and Hot Chocolate - Blexin\" \/>\n<meta property=\"og:description\" content=\"GraphQL: let\u2019s see how we can test queries and mutation in ASP.NET Core with Hot Chocolate\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/\" \/>\n<meta property=\"og:site_name\" content=\"Blexin\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-30T22:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-20T16:25:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i1.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/f05eb91a-2779-4926-9141-5f41a88a81d3.png?fit=1024%2C608&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"608\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Adolfo Arnold\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Adolfo Arnold\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/testing-our-api-with-graphql-and-hot-chocolate\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/testing-our-api-with-graphql-and-hot-chocolate\\\/\"},\"author\":{\"name\":\"Adolfo Arnold\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/0de430b61c8a48b0e9d81308817c1517\"},\"headline\":\"Testing our API with GraphQL and Hot Chocolate\",\"datePublished\":\"2020-06-30T22:00:00+00:00\",\"dateModified\":\"2021-05-20T16:25:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/testing-our-api-with-graphql-and-hot-chocolate\\\/\"},\"wordCount\":970,\"image\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/testing-our-api-with-graphql-and-hot-chocolate\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/f05eb91a-2779-4926-9141-5f41a88a81d3.png?fit=1024%2C608&ssl=1\",\"keywords\":[\"Asp.net core\",\"C#\",\"GraphQL\",\"Testing\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/testing-our-api-with-graphql-and-hot-chocolate\\\/\",\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/testing-our-api-with-graphql-and-hot-chocolate\\\/\",\"name\":\"Testing our API with GraphQL and Hot Chocolate - Blexin\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/testing-our-api-with-graphql-and-hot-chocolate\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/testing-our-api-with-graphql-and-hot-chocolate\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/f05eb91a-2779-4926-9141-5f41a88a81d3.png?fit=1024%2C608&ssl=1\",\"datePublished\":\"2020-06-30T22:00:00+00:00\",\"dateModified\":\"2021-05-20T16:25:02+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/0de430b61c8a48b0e9d81308817c1517\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/testing-our-api-with-graphql-and-hot-chocolate\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/testing-our-api-with-graphql-and-hot-chocolate\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/testing-our-api-with-graphql-and-hot-chocolate\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/f05eb91a-2779-4926-9141-5f41a88a81d3.png?fit=1024%2C608&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/f05eb91a-2779-4926-9141-5f41a88a81d3.png?fit=1024%2C608&ssl=1\",\"width\":1024,\"height\":608},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/testing-our-api-with-graphql-and-hot-chocolate\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/blexin.com\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Testing our API with GraphQL and Hot Chocolate\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/\",\"name\":\"Blexin\",\"description\":\"Con noi \u00e8 semplice\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blexin.com\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/0de430b61c8a48b0e9d81308817c1517\",\"name\":\"Adolfo Arnold\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ff2a87b54d0f130d7452164533199af05ef16dbd08b9241729946cea0eec7cca?s=96&d=identicon&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ff2a87b54d0f130d7452164533199af05ef16dbd08b9241729946cea0eec7cca?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ff2a87b54d0f130d7452164533199af05ef16dbd08b9241729946cea0eec7cca?s=96&d=identicon&r=g\",\"caption\":\"Adolfo Arnold\"},\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/author\\\/adolfo-arnoldblexin-com\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Testing our API with GraphQL and Hot Chocolate - Blexin","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/","og_locale":"en_US","og_type":"article","og_title":"Testing our API with GraphQL and Hot Chocolate - Blexin","og_description":"GraphQL: let\u2019s see how we can test queries and mutation in ASP.NET Core with Hot Chocolate","og_url":"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/","og_site_name":"Blexin","article_published_time":"2020-06-30T22:00:00+00:00","article_modified_time":"2021-05-20T16:25:02+00:00","og_image":[{"width":1024,"height":608,"url":"https:\/\/i1.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/f05eb91a-2779-4926-9141-5f41a88a81d3.png?fit=1024%2C608&ssl=1","type":"image\/png"}],"author":"Adolfo Arnold","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Adolfo Arnold","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/#article","isPartOf":{"@id":"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/"},"author":{"name":"Adolfo Arnold","@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/0de430b61c8a48b0e9d81308817c1517"},"headline":"Testing our API with GraphQL and Hot Chocolate","datePublished":"2020-06-30T22:00:00+00:00","dateModified":"2021-05-20T16:25:02+00:00","mainEntityOfPage":{"@id":"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/"},"wordCount":970,"image":{"@id":"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/f05eb91a-2779-4926-9141-5f41a88a81d3.png?fit=1024%2C608&ssl=1","keywords":["Asp.net core","C#","GraphQL","Testing"],"articleSection":["Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/","url":"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/","name":"Testing our API with GraphQL and Hot Chocolate - Blexin","isPartOf":{"@id":"https:\/\/blexin.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/#primaryimage"},"image":{"@id":"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/f05eb91a-2779-4926-9141-5f41a88a81d3.png?fit=1024%2C608&ssl=1","datePublished":"2020-06-30T22:00:00+00:00","dateModified":"2021-05-20T16:25:02+00:00","author":{"@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/0de430b61c8a48b0e9d81308817c1517"},"breadcrumb":{"@id":"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/#primaryimage","url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/f05eb91a-2779-4926-9141-5f41a88a81d3.png?fit=1024%2C608&ssl=1","contentUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/f05eb91a-2779-4926-9141-5f41a88a81d3.png?fit=1024%2C608&ssl=1","width":1024,"height":608},{"@type":"BreadcrumbList","@id":"https:\/\/blexin.com\/en\/blog-en\/testing-our-api-with-graphql-and-hot-chocolate\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blexin.com\/en\/"},{"@type":"ListItem","position":2,"name":"Testing our API with GraphQL and Hot Chocolate"}]},{"@type":"WebSite","@id":"https:\/\/blexin.com\/en\/#website","url":"https:\/\/blexin.com\/en\/","name":"Blexin","description":"Con noi \u00e8 semplice","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blexin.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/0de430b61c8a48b0e9d81308817c1517","name":"Adolfo Arnold","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ff2a87b54d0f130d7452164533199af05ef16dbd08b9241729946cea0eec7cca?s=96&d=identicon&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ff2a87b54d0f130d7452164533199af05ef16dbd08b9241729946cea0eec7cca?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ff2a87b54d0f130d7452164533199af05ef16dbd08b9241729946cea0eec7cca?s=96&d=identicon&r=g","caption":"Adolfo Arnold"},"url":"https:\/\/blexin.com\/en\/author\/adolfo-arnoldblexin-com\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/f05eb91a-2779-4926-9141-5f41a88a81d3.png?fit=1024%2C608&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pcyUBx-6V0","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/26598","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/users\/196716250"}],"replies":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/comments?post=26598"}],"version-history":[{"count":8,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/26598\/revisions"}],"predecessor-version":[{"id":32904,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/26598\/revisions\/32904"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/media\/26574"}],"wp:attachment":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/media?parent=26598"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/categories?post=26598"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/tags?post=26598"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}