Run() public method

Runs StorageSample.exe with the provided arguments
public Run ( ) : ConsoleOutput
return ConsoleOutput
        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);
        }
示例#3
0
        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));
            }
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
        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);
        }
示例#7
0
        public void TestCreateTask()
        {
            ConsoleOutput output = _tasks.Run(
                "createTask",
                "--projectId", ProjectId,
                "--location", LocationId,
                "--queue", QueueId,
                "--payload", "Test Payload"
                );

            Assert.Contains("Created Task", output.Stdout);
        }
示例#8
0
        public void TestList()
        {
            ConsoleOutput output = _runner.Run("list");

            Assert.Equal(0, output.ExitCode);
            Assert.Contains("en-US-Standard-B", output.Stdout);
        }
示例#9
0
        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");
        }
示例#10
0
        // 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"));
        }
示例#11
0
        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);
            }
        }
示例#12
0
        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());
        }
示例#13
0
        // 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);
            }
        }
示例#14
0
        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);
        }
示例#15
0
        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"));
        }
示例#17
0
            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)));
 }
示例#19
0
 protected ConsoleOutput RunManageIndexes(params string[] args)
 {
     return(_manageIndexes.Run(args));
 }
示例#20
0
 protected ConsoleOutput RunPaginateData(params string[] args)
 {
     return(_paginateData.Run(args));
 }
示例#21
0
 protected ConsoleOutput RunTransactionsAndBatchedWrites(params string[] args)
 {
     return(_transactionsAndBatchedWrites.Run(args));
 }
示例#22
0
 protected ConsoleOutput RunDataModel(params string[] args)
 {
     return(_dataModel.Run(args));
 }
示例#23
0
 protected ConsoleOutput RunOrderLimitData(params string[] args)
 {
     return(_orderLimitData.Run(args));
 }
示例#24
0
 protected ConsoleOutput RunQueryData(params string[] args)
 {
     return(_queryData.Run(args));
 }
示例#25
0
 protected ConsoleOutput RunListenData(params string[] args)
 {
     return(_listenData.Run(args));
 }
示例#26
0
 protected ConsoleOutput RunGetData(params string[] args)
 {
     return(_getData.Run(args));
 }
示例#27
0
 protected ConsoleOutput RunDeleteData(params string[] args)
 {
     return(_deleteData.Run(args));
 }
示例#28
0
 protected ConsoleOutput RunAddData(params string[] args)
 {
     return(_addData.Run(args));
 }
示例#29
0
 protected ConsoleOutput RunQuickstart(params string[] args)
 {
     return(_quickstart.Run(args));
 }
示例#30
0
        public void TestList()
        {
            var result = _alert.Run("list", "-p", _fixture.ProjectId);

            Assert.Equal(0, result.ExitCode);
        }