コード例 #1
0
ファイル: RQLClientTests.cs プロジェクト: clegendre/RQL.Net
 public void CreateRqlRequestWithMissingFileInQuery()
 {
     Assert.Throws <ArgumentException>(() =>
                                       RQLRequestBuilder
                                       .Query("Any A WHERE A is AuthToken, A token_for_user U, U login %(user_name)s")
                                       .WithParam("user_name", "MyUserName")
                                       .WithFile("file", Array.Empty <byte>())
                                       .Build()
                                       );
 }
コード例 #2
0
ファイル: RQLClientTests.cs プロジェクト: clegendre/RQL.Net
 public void CreateRqlRequestWithMissingParameterInQuery()
 {
     Assert.Throws <ArgumentException>(() =>
                                       RQLRequestBuilder
                                       .Query("Any A WHERE A is AuthToken, A token_for_user U, U login %(user_name)s")
                                       .WithParam("user_name", "MyUserName")
                                       .WithParam("user_email", "*****@*****.**")
                                       .Build()
                                       );
 }
コード例 #3
0
ファイル: RQLClientTests.cs プロジェクト: clegendre/RQL.Net
        public void CreateRqlBatchRequests()
        {
            var batch = RQLRequestBuilder
                        .Query("Any A WHERE A is AuthToken, A token_for_user U, U login %(user_name)s")
                        .WithParam("user_name", "MyUserName")
                        .AddNewQuery("Any A WHERE A is AuthToken, A token_for_user U, U login %(user_name)s")
                        .WithParam("user_name", "MyUserName2")
                        .Build();

            Assert.That(batch.Requests.Count, Is.EqualTo(2));
        }
コード例 #4
0
ファイル: RQLClientTests.cs プロジェクト: clegendre/RQL.Net
        public void CreateRqlBatchRequestsWithFile(string fileName)
        {
            var file        = TestHelper.TestProjectFolder.Combine($"In/{fileName}");
            var fileContent = File.ReadAllBytes(file);
            var batch       = RQLRequestBuilder
                              .Query("Any A WHERE A is AuthToken, A token_for_user U, U login %(user_name)s")
                              .WithParam("user_name", "MyUserName")
                              .AddNewQuery("Any A WHERE A is AuthToken, A token_for_user U, U login %(user_name)s, A file_for %(file)s")
                              .WithParam("user_name", "MyUserName2")
                              .WithFile("file", fileContent)
                              .Build();

            Assert.That(batch.Requests.Count, Is.EqualTo(2));
            Assert.That(batch.Requests[1].Files.Count, Is.EqualTo(1));
        }
コード例 #5
0
ファイル: RQLClientTests.cs プロジェクト: clegendre/RQL.Net
        public async Task CreateRqlRequest()
        {
            var rqlRequest = RQLRequestBuilder
                             .Query("Any A WHERE A is AuthToken, A token_for_user U, U login %(user_name)s, U email %(user_email)s")
                             .WithParam("user_name", "MyUserName")
                             .WithParam("user_email", "*****@*****.**")
                             .Build();

            var rqlClient   = CreateRqlClient();
            var httpContent = await rqlClient.CreateHttpContentAsync(rqlRequest);

            var httpContentString = await httpContent.ReadAsStringAsync();

            var httpContentOutFilePath = TestHelper.TestProjectFolder.Combine($"Out/basic.txt");
            await File.WriteAllTextAsync(httpContentOutFilePath, httpContentString);
        }
コード例 #6
0
ファイル: RQLClientTests.cs プロジェクト: clegendre/RQL.Net
        public async Task CreateRqlRequestWithFiles(string fileName)
        {
            var file        = TestHelper.TestProjectFolder.Combine($"In/{fileName}");
            var fileContent = await File.ReadAllBytesAsync(file);

            var rqlRequest = RQLRequestBuilder
                             .Query("Any A WHERE A is AuthToken, A token_for_user U, U login %(user_name)s, A file_for %(file)s")
                             .WithParam("user_name", "MyUserName")
                             .WithFile("file", fileContent)
                             .Build();

            var rqlClient   = CreateRqlClient();
            var httpContent = await rqlClient.CreateHttpContentAsync(rqlRequest);

            var httpContentString = await httpContent.ReadAsStringAsync();

            var httpContentOutFilePath = TestHelper.TestProjectFolder.Combine($"Out/{fileName}.txt");
            await File.WriteAllTextAsync(httpContentOutFilePath, httpContentString);
        }