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() ); }
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() ); }
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)); }
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)); }
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); }
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); }