protected override ConsoleOutput Run(params string[] args) { string uriPrefix = "https://raw.githubusercontent.com/GoogleCloudPlatform/"; string uriSampleFilePath = "dotnet-docs-samples/master/vision/api/VisionTest/data/"; string filePublicUri = uriPrefix + uriSampleFilePath + Path.GetFileName(args[1]); return(_detect.Run(args[0], filePublicUri)); }
// Run command and return output. // Project ID argument is always set. // Session ID argument available as a parameter. // Sets helper properties to last console output. public ConsoleOutput Run(string command, params object[] args) { var arguments = args.Select((arg) => arg.ToString()).ToList(); arguments.Insert(0, command); arguments.AddRange(new[] { "--projectId", ProjectId }); Output = _dialogflow.Run(arguments.ToArray()); return(Output); }
protected override ConsoleOutput Run(params string[] args) { string objectName = "VisionTest/" + Path.GetFileName(args[1]); string[] cmdArgs = { args[0], $"gs://{_bucketName}/{objectName}" }; using (var collector = new BucketCollector(_bucketName)) { collector.CopyToBucket(args[1], objectName); return(_detect.Run(cmdArgs)); } }
public void TestExportAssets() { string projectId = Environment.GetEnvironmentVariable("GOOGLE_PROJECT_ID"); Environment.SetEnvironmentVariable("AssetBucketName", _bucketName); var output = s_runner.Run(); _testOutput.WriteLine(output.Stdout); string expectedOutput = String.Format("\"outputConfig\": {{ \"gcsDestination\": {{ \"uri\": \"gs://{0}/my-assets.txt\" }} }}", _bucketName); Assert.Contains(expectedOutput, output.Stdout); }
public void TestList() { _output.WriteLine(Google.Protobuf.JsonFormatter.Default .Format((IMessage)_fixture.Alert)); _output.WriteLine(Google.Protobuf.JsonFormatter.Default .Format((IMessage)_fixture.Channel)); var result = _alert.Run("list", "-p", _fixture.ProjectId); Assert.Equal(0, result.ExitCode); }
public void TestRunSimpleApp() { var output = _simpleApp.Run(); Assert.Equal(0, output.ExitCode); var outputLines = output.Stdout.Split(new[] { '\n' }); string rowPrefix = "https://stackoverflow.com/questions/"; int rowCount = outputLines.Where( line => line.StartsWith(rowPrefix)).Count(); Assert.Equal(10, rowCount); }
public void TestCreateTask() { ConsoleOutput output = _tasks.Run( "createTask", "--projectId", ProjectId, "--location", LocationId, "--queue", QueueId, "--payload", "Test Payload" ); Assert.Contains("Created Task", output.Stdout); }
public void TestList() { ConsoleOutput output = _runner.Run("list"); Assert.Equal(0, output.ExitCode); Assert.Contains("en-US-Standard-B", output.Stdout); }
public void TestQuickStart() { ConsoleOutput output = _runner.Run(); Assert.Equal(0, output.ExitCode); Assert.True(File.Exists("sample.mp3")); FileInfo fileInfo = new FileInfo("sample.mp3"); Assert.True(fileInfo.Length > 0); // Clean up File.Delete("output.mp3"); }
// Clean up function to delete all collections and indexes after testing is complete public void Dispose() { CommandLineRunner _manageIndexes = new CommandLineRunner() { VoidMain = ManageIndexes.Main, Command = "dotnet run" }; DeleteCollection("users").Wait(); DeleteCollection("cities/SF/neighborhoods").Wait(); DeleteCollection("cities").Wait(); DeleteCollection("data").Wait(); _manageIndexes.Run("delete-indexes", Environment.GetEnvironmentVariable("FIRESTORE_PROJECT_ID")); }
public void TestBatchGetAssetsHistory() { string assetName = String.Format("//storage.googleapis.com/{0}", _bucketName); Environment.SetEnvironmentVariable("ASSET_NAME", assetName); var output = s_runner.Run(); _testOutput.WriteLine(output.Stdout); string expectedOutput = assetName; if (output.Stdout.Length > 0) { Assert.Contains(expectedOutput, output.Stdout); } }
public void TestRunQuickStart() { string expectedOutputFirstWord = "Dataset"; string expectedOutputLastWord = "created."; string sampleDatasetUsedInQuickStart = "my_new_dataset"; _datasetsToDelete.Add(sampleDatasetUsedInQuickStart); var output = _quickStart.Run(); Assert.Equal(0, output.ExitCode); var outputParts = output.Stdout.Split(new[] { ' ' }); Assert.Equal(expectedOutputFirstWord, outputParts.First().Trim()); Assert.Equal(expectedOutputLastWord, outputParts.Last().Trim()); }
// Run command and return output. // Project ID argument is always set. // Session ID argument available as a parameter. // Sets helper properties to last console output. public ConsoleOutput Run(string command, params object[] args) { using (var thottleToken = s_throttleTokenPool.Acquire()) { var arguments = args.Select((arg) => arg.ToString()).ToList(); arguments.Insert(0, command); arguments.AddRange(new[] { "--projectId", ProjectId }); try { Output = _dialogflow.Run(arguments.ToArray()); } catch (Grpc.Core.RpcException e) when(e.Status.StatusCode == Grpc.Core.StatusCode.ResourceExhausted) { // Throttle some more! int randomDelay = new Random().Next(60, 120); System.Threading.Thread.Sleep(TimeSpan.FromSeconds(randomDelay)); // And try once more. Output = _dialogflow.Run(arguments.ToArray()); } return(Output); } }
protected ConsoleOutput Run(params string[] args) { string cmd = args[0].ToLower(); var output = _pubsub.Run(args); switch (cmd) { case "createtopic": _tempTopicIds.Add(args[2]); break; case "createsubscription": _tempSubscriptionIds.Add(args[3]); break; } return(output); }
public void HowToSearchTest() { var output = _howToSearch.Run(); _testOutput.WriteLine(output.Stdout); Assert.Equal(0, output.ExitCode); Assert.Contains("Jobs category searched", output.Stdout); Assert.Contains("Jobs employment type searched", output.Stdout); Assert.Contains("Jobs language codes searched", output.Stdout); Assert.Contains("Jobs company display names searched", output.Stdout); Assert.Contains("Jobs compensation searched", output.Stdout); Assert.Contains("Jobs basic location searched", output.Stdout); Assert.Contains("Jobs location and keyword searched", output.Stdout); Assert.Contains("Jobs city level searched", output.Stdout); Assert.Contains("Jobs multi location searched", output.Stdout); Assert.Contains("Jobs broadening searched", output.Stdout); Assert.Contains("Jobs commute searched", output.Stdout); }
// Clean up function to delete all collections and indexes after testing is complete public void Dispose() { CommandLineRunner _manageIndexes = new CommandLineRunner() { VoidMain = ManageIndexes.Main, Command = "dotnet run" }; ConsoleOutput RunManageIndexes(params string[] args) { return(_manageIndexes.Run(args)); } DeleteCollection("users").Wait(); DeleteCollection("cities/SF/neighborhoods").Wait(); DeleteCollection("cities").Wait(); DeleteCollection("data").Wait(); var manageIndexesOutput = RunManageIndexes("delete-indexes", Environment.GetEnvironmentVariable("FIRESTORE_PROJECT_ID")); }
public void TestRunQuickStart() { string expectedOutput = "Log Entry created."; // This logId should match the logId value set in QuickStart\QuickStart.cs string logId = "my-log"; string message = "Hello World!"; _logsToDelete.Add(logId); var output = _quickStart.Run(); Assert.Equal(expectedOutput, output.Stdout.Trim()); Eventually(() => { // Retrieve the log entry just added, using the logId as a filter. var results = Run("list-log-entries", logId); // Confirm returned log entry contains expected value. Assert.Contains(message, results.Stdout); }); }
/// <summary>Runs StorageSample.exe with the provided arguments</summary> /// <returns>The console output of this program</returns> public static ConsoleOutput Run(params string[] arguments) { return(s_retryTransientRpcErrors.Eventually( () => s_runner.Run(arguments))); }
protected ConsoleOutput RunManageIndexes(params string[] args) { return(_manageIndexes.Run(args)); }
protected ConsoleOutput RunPaginateData(params string[] args) { return(_paginateData.Run(args)); }
protected ConsoleOutput RunTransactionsAndBatchedWrites(params string[] args) { return(_transactionsAndBatchedWrites.Run(args)); }
protected ConsoleOutput RunDataModel(params string[] args) { return(_dataModel.Run(args)); }
protected ConsoleOutput RunOrderLimitData(params string[] args) { return(_orderLimitData.Run(args)); }
protected ConsoleOutput RunQueryData(params string[] args) { return(_queryData.Run(args)); }
protected ConsoleOutput RunListenData(params string[] args) { return(_listenData.Run(args)); }
protected ConsoleOutput RunGetData(params string[] args) { return(_getData.Run(args)); }
protected ConsoleOutput RunDeleteData(params string[] args) { return(_deleteData.Run(args)); }
protected ConsoleOutput RunAddData(params string[] args) { return(_addData.Run(args)); }
protected ConsoleOutput RunQuickstart(params string[] args) { return(_quickstart.Run(args)); }
public void TestList() { var result = _alert.Run("list", "-p", _fixture.ProjectId); Assert.Equal(0, result.ExitCode); }