public void Should_HandleTsdbSortRoundTrip()
    {
        // Sorts against a time series required changes to the sort field in the response to support `Map` as an acceptable instance.
        // This test validates that we can roundtrip such values using the current model and serialiser.
        // See https://github.com/elastic/elasticsearch/pull/81583

        var json = @"{""_index"":""test"",""_id"":""9fLsn30BuA_D-fdpROsd"",""_score"":null,""_source"":{""@timestamp"":
""2021-04-28T18:51:03.142Z"",""k8s"":{""pod"":{""uid"":""df3145b3-0563-4d3b-a0f7-897eb2876ea9"",""ip"":""10.10.55.3"",
""name"":""dog"",""network"":{""tx"":1434595272,""rx"":530605511}}},""metricset"":""pod""},""sort"":[{""k8s.pod.uid"":
""df3145b3-0563-4d3b-a0f7-897eb2876ea9"",""metricset"":""pod""},1619635863142]}";

        var stream = WrapInStream(json);

        var search = _requestResponseSerializer.Deserialize <Hit <Metric> >(stream);

        search.Sort.Count.Should().Be(2);

        var roundTripExample = new SearchExample {
            Sort = search.Sort
        };

        var serialisedJson = SerializeAndGetJsonString(roundTripExample);

        serialisedJson.Should().Be(@"{""sort"":[{""k8s.pod.uid"":""df3145b3-0563-4d3b-a0f7-897eb2876ea9"",""metricset"":""pod""},1619635863142]}");

        var objectExample = new SearchExample
        {
            Sort = new object[]
            {
                new Dictionary <string, string>
                {
                    { "k8s.pod.uid", "df3145b3-0563-4d3b-a0f7-897eb2876ea9" },
                    { "metricset", "pod" }
                },
                1619635863142
            }
        };

        serialisedJson = SerializeAndGetJsonString(objectExample);
        serialisedJson.Should().Be(@"{""sort"":[{""k8s.pod.uid"":""df3145b3-0563-4d3b-a0f7-897eb2876ea9"",""metricset"":""pod""},1619635863142]}");
    }
        private static void Main()
        {
            try
            {
                Initialize();

                Console.WriteLine(@"C# Sample App starting...");
                Console.WriteLine();

                /*
                 * The sample app will show simplified examples of calls that you can make against the
                 * api gateway using the available REST calls.
                 *
                 * The example calls that this app will make include:
                 *
                 * Authorization
                 * - OAuth authorization call (to allow this app to connect to the gateway and make API calls)
                 *
                 * Provisioning
                 * - Creating new users associated with a company
                 * - Creating a new user group (a group as defined in Syncplicity as having access to the same shared folders)
                 * - Associating the newly created users with the new user group
                 *
                 * Content
                 * - Creating a Syncpoint to allow uploads/downloads to folders
                 * - Creating a folder
                 * - Uploading a file into the folder
                 * - Downloading the uploaded file
                 * - Removing the uploaded file
                 * - Removing the folder
                 * - Changing owner of the syncpoint
                 * - Searching files and folders
                 */

                ValidateRequiredConfiguration();

                GolGateway.LoadRols(ConfigurationHelper.OwnerEmail);

                ApiGateway.Authenticate();

                Console.WriteLine();

                if (!ApiContext.Authenticated)
                {
                    Console.WriteLine("The OAuth authentication has failed, the app cannot continue.");

                    Console.WriteLine();
                    Console.WriteLine("Press enter to close...");
                    Console.ReadLine();

                    Environment.Exit(1);
                }
                else
                {
                    Console.WriteLine("Authentication was successful. Press enter to continue to Provisioning example.");
                    Console.ReadLine();
                }

                ProvisioningExample.Execute();
                Console.WriteLine();
                Console.WriteLine("Provisioning part is completed. Press enter to continue to simple file upload example.");
                Console.ReadLine();

                ContentExample.ExecuteSimple();
                Console.WriteLine();
                Console.WriteLine("Simple upload part is completed. Press enter to continue to chunked file upload example.");
                Console.ReadLine();

                ContentExample.ExecuteChunked();
                Console.WriteLine();
                Console.WriteLine("Chunked upload part is completed. Press enter to continue to create IRM shared links example.");
                Console.ReadLine();

                ContentExample.ExecuteLinksPost();
                Console.WriteLine();
                Console.WriteLine("Create a shared link part is completed. Press enter to continue to Get shared file links example.");
                Console.ReadLine();

                ContentExample.ExecuteLinksGet();
                Console.WriteLine();
                Console.WriteLine("Get shared file links part is completed. Press enter to continue to Get a shared file link metadata example.");
                Console.ReadLine();

                ContentExample.ExecuteLinkTokenGet();
                Console.WriteLine();
                Console.WriteLine("Get shared file links part is completed. Press enter to continue to Update a shared file link example.");
                Console.ReadLine();

                ContentExample.ExecuteLinkTokenPut();
                Console.WriteLine();
                Console.WriteLine("Update a shared file link part is completed. Press enter to continue to Delete a shared file link example.");
                Console.ReadLine();

                ContentExample.ExecuteLinkTokenDelete();
                Console.WriteLine();
                Console.WriteLine("Delete a shared file link part is completed. Press enter to continue to rename folder example.");
                Console.ReadLine();

                ContentExample.ExecuteRenameFolder();
                Console.WriteLine();
                Console.WriteLine("Rename folder part is completed. Press enter to continue to content rename file example.");
                Console.ReadLine();

                ContentExample.ExecuteRenameFile();
                Console.WriteLine();
                Console.WriteLine("Rename file part is completed. Press enter to continue to newsfeed events example.");
                Console.ReadLine();

                ContentExample.ExecuteNewsFeedEvents();
                Console.WriteLine();
                Console.WriteLine("NewsFeed Events part is completed. Press enter to continue to content create nested folders example.");
                Console.ReadLine();

                ContentExample.ExecuteCreateNestedFolder();
                Console.WriteLine();
                Console.WriteLine("Create nested folders part is completed. Press enter to continue to content search example.");
                Console.ReadLine();

                SearchExample.Execute();
                Console.WriteLine();
                Console.WriteLine("Search part is completed. Press enter to continue to folder tagging example.");
                Console.ReadLine();

                ContentExample.ExecuteFolderTagging();
                Console.WriteLine();
                Console.WriteLine("Folder tagging part is completed. Press enter to continue to file tagging example.");
                Console.ReadLine();

                ContentExample.ExecuteFileTagging();
                Console.WriteLine();
                Console.WriteLine("File tagging part is completed. Press enter to continue to on behalf of another user example.");
                Console.ReadLine();

                ContentExample.ExecuteOnBehalfOf();
                Console.WriteLine();
                Console.WriteLine("On-Behalf-Of part is completed. Press enter to continue to legal hold example.");
                Console.ReadLine();

                ContentExample.ExecuteLegalHold();
                Console.WriteLine();
                Console.WriteLine("Content part is completed. Press enter to exit...");
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine();
                Console.WriteLine("Fatal error");
                Console.WriteLine(e);
                Console.WriteLine();

                Console.WriteLine("Press enter to exit.");
                Console.ReadLine();
            }
        }