コード例 #1
0
        public void BasicEnvTest()
        {
            // as the attribute says, this test requires 5.0-rc1 or newer.  This has been tested locally on
            // an rc1 build and passes.  It is equivalent to the dotnet/runtime version of this test.
            TestRunner runner  = new TestRunner(CommonHelper.GetTraceePathWithArgs(targetFramework: "net5.0"), output);
            string     testKey = "FOO";
            string     testVal = "BAR";

            runner.AddEnvVar(testKey, testVal);
            runner.Start(3000);
            DiagnosticsClient           client = new DiagnosticsClient(runner.Pid);
            Dictionary <string, string> env    = client.GetProcessEnvironment();

            Assert.True(env.ContainsKey(testKey) && env[testKey].Equals(testVal));

            runner.Stop();
        }
コード例 #2
0
        /// <summary>
        /// A simple test that collects process environment.
        /// </summary>
        private async Task BasicEnvTestCore(bool useAsync)
        {
            // as the attribute says, this test requires 5.0-rc1 or newer.  This has been tested locally on
            // an rc1 build and passes.  It is equivalent to the dotnet/runtime version of this test.
            using TestRunner runner = new TestRunner(CommonHelper.GetTraceePathWithArgs(targetFramework: "net5.0"), output);
            string testKey = "FOO";
            string testVal = "BAR";

            runner.AddEnvVar(testKey, testVal);
            runner.Start(timeoutInMSPipeCreation: 3000);
            var clientShim = new DiagnosticsClientApiShim(new DiagnosticsClient(runner.Pid), useAsync);
            Dictionary <string, string> env = await clientShim.GetProcessEnvironment();

            Assert.True(env.ContainsKey(testKey) && env[testKey].Equals(testVal));

            runner.Stop();
        }
コード例 #3
0
 public static void SuspendDefaultDiagnosticPort(this TestRunner runner)
 {
     runner.AddEnvVar(DefaultDiagnosticPortSuspendEnvName, "1");
 }
コード例 #4
0
 public static void AddReversedServer(this TestRunner runner, string transportName)
 {
     runner.AddEnvVar("DOTNET_DiagnosticsMonitorAddress", transportName);
     runner.AddEnvVar("DOTNET_DiagnosticPorts", $"{transportName},nosuspend;");
 }
コード例 #5
0
        public static void SetDiagnosticPort(this TestRunner runner, string transportName, bool suspend)
        {
            string suspendArgument = suspend ? "suspend" : "nosuspend";

            runner.AddEnvVar(DiagnosticPortsEnvName, $"{transportName},connect,{suspendArgument};");
        }