Ejemplo n.º 1
0
        public void PrintVersion()
        {
            string expectedVersion = WrapperService.Version.ToString();
            string cliOut          = CLITestHelper.CLITest(new[] { "version" });

            StringAssert.Contains(expectedVersion, cliOut, "Expected that version contains " + expectedVersion);
        }
Ejemplo n.º 2
0
        public void PrintVersion()
        {
            string expectedVersion = WrapperService.Version.ToString();
            string cliOut          = CLITestHelper.CLITest(new[] { "version" });

            Assert.That(cliOut, Does.Contain(expectedVersion));
        }
Ejemplo n.º 3
0
        public void FailOnUnsupportedCommand()
        {
            const string  commandName     = "nonExistentCommand";
            string        expectedMessage = "Unknown command: " + commandName;
            CLITestResult result          = CLITestHelper.CLIErrorTest(new[] { commandName });

            Assert.That(result.HasException, Is.True);
            Assert.That(result.Out, Does.Contain(expectedMessage));
            Assert.That(result.Exception.Message, Does.Contain(expectedMessage));
        }
Ejemplo n.º 4
0
        public void FailOnUnsupportedCommand()
        {
            const string  commandName     = "nonExistentCommand";
            string        expectedMessage = "Unknown command: " + commandName.ToLower();
            CLITestResult res             = CLITestHelper.CLIErrorTest(new[] { commandName });

            Assert.True(res.HasException, "Expected an exception due to the wrong command");
            StringAssert.Contains(expectedMessage, res.Out, "Expected the message about unknown command");
            // ReSharper disable once PossibleNullReferenceException
            StringAssert.Contains(expectedMessage, res.Exception.Message, "Expected the message about unknown command");
        }
Ejemplo n.º 5
0
        public void PrintHelp()
        {
            string expectedVersion = WrapperService.Version.ToString();
            string cliOut          = CLITestHelper.CLITest(new[] { "help" });

            StringAssert.Contains(expectedVersion, cliOut, "Expected that help contains " + expectedVersion);
            StringAssert.Contains("start", cliOut, "Expected that help refers start command");
            StringAssert.Contains("help", cliOut, "Expected that help refers help command");
            StringAssert.Contains("version", cliOut, "Expected that help refers version command");
            // TODO: check all commands after the migration of ccommands to enum

            // Extra options
            StringAssert.Contains("/redirect", cliOut, "Expected that help message refers the redirect message");
        }
Ejemplo n.º 6
0
        public void PrintHelp()
        {
            string expectedVersion = WrapperService.Version.ToString();
            string cliOut          = CLITestHelper.CLITest(new[] { "help" });

            Assert.That(cliOut, Does.Contain(expectedVersion));
            Assert.That(cliOut, Does.Contain("start"));
            Assert.That(cliOut, Does.Contain("help"));
            Assert.That(cliOut, Does.Contain("version"));
            // TODO: check all commands after the migration of ccommands to enum

            // Extra options
            Assert.That(cliOut, Does.Contain("/redirect"));
        }
Ejemplo n.º 7
0
        public void TestInstall()
        {
            TestHelper.RequireProcessElevated();

            try
            {
                _ = CLITestHelper.CLITest(new[] { "install" });

                using ServiceController controller = new ServiceController(CLITestHelper.Id);
                Assert.That(controller.DisplayName, Is.EqualTo(CLITestHelper.Name));
                Assert.That(controller.CanStop, Is.False);
                Assert.That(controller.CanShutdown, Is.False);
                Assert.That(controller.CanPauseAndContinue, Is.False);
                Assert.That(controller.Status, Is.EqualTo(ServiceControllerStatus.Stopped));
                Assert.That(controller.ServiceType, Is.EqualTo(ServiceType.Win32OwnProcess));
            }
            finally
            {
                _ = CLITestHelper.CLITest(new[] { "uninstall" });
            }
        }
Ejemplo n.º 8
0
        public void ShouldNotPrintLogsForStatusCommand()
        {
            string cliOut = CLITestHelper.CLITest(new[] { "status" });

            StringAssert.AreEqualIgnoringCase("NonExistent\r\n", cliOut);
        }
Ejemplo n.º 9
0
        public void ShouldNotPrintLogsForStatusCommand()
        {
            string cliOut = CLITestHelper.CLITest(new[] { "status" });

            Assert.That(cliOut, Is.EqualTo("NonExistent" + Environment.NewLine).IgnoreCase);
        }