Exemple #1
0
        public void GivenEnvironmentAndReporterItPrintsNothingWhenenvironmentExists(string existingPath)
        {
            var fakeReporter       = new FakeReporter();
            var osxEnvironmentPath = new OSXEnvironmentPath(
                new BashPathUnderHomeDirectory("/myhome", "executable/path"),
                fakeReporter,
                new FakeEnvironmentProvider(
                    new Dictionary <string, string>
            {
                { "PATH", existingPath }
            }),
                FakeFile.Empty);

            osxEnvironmentPath.PrintAddPathInstructionIfPathDoesNotExist();

            fakeReporter.Message.Should().BeEmpty();
        }
        public void GivenAddPackageExecutablePathToUserPathJustRunItPrintsInstructionToLogout()
        {
            var fakeReporter       = new FakeReporter();
            var osxEnvironmentPath = new OSXEnvironmentPath(
                new BashPathUnderHomeDirectory("/myhome", "executable/path"),
                fakeReporter,
                new FakeEnvironmentProvider(
                    new Dictionary <string, string>
            {
                { "PATH", @"" }
            }),
                FakeFile.Empty);

            osxEnvironmentPath.AddPackageExecutablePathToUserPath();

            osxEnvironmentPath.PrintAddPathInstructionIfPathDoesNotExist();

            fakeReporter.Message.Should().Be(CommonLocalizableStrings.EnvironmentPathOSXNeedReopen);
        }
Exemple #3
0
        public void GivenAddPackageExecutablePathToUserPathJustRunItPrintsInstructionToLogout()
        {
            var fakeReporter       = new FakeReporter();
            var osxEnvironmentPath = new OSXEnvironmentPath(
                new BashPathUnderHomeDirectory("/myhome", "executable/path"),
                fakeReporter,
                new FakeEnvironmentProvider(
                    new Dictionary <string, string>
            {
                { "PATH", @"" }
            }),
                FakeFile.Empty);

            osxEnvironmentPath.AddPackageExecutablePathToUserPath();

            osxEnvironmentPath.PrintAddPathInstructionIfPathDoesNotExist();

            fakeReporter.Message.Should().Be(
                "Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed.");
        }
Exemple #4
0
        public void GivenEnvironmentAndReporterItCanPrintOutInstructionToAddPath()
        {
            var fakeReporter         = new FakeReporter();
            var linuxEnvironmentPath = new LinuxEnvironmentPath(
                new BashPathUnderHomeDirectory("/myhome", "executable/path"),
                fakeReporter,
                new FakeEnvironmentProvider(
                    new Dictionary <string, string>
            {
                { "PATH", "" }
            }),
                FakeFile.Empty);

            linuxEnvironmentPath.PrintAddPathInstructionIfPathDoesNotExist();

            // similar to https://code.visualstudio.com/docs/setup/mac
            fakeReporter.Message.Should().Be(
                string.Format(
                    CommonLocalizableStrings.EnvironmentPathLinuxManualInstruction,
                    "/myhome/executable/path", "/myhome/executable/path"));
        }
Exemple #5
0
        public void GivenEnvironmentAndReporterItCanPrintOutInstructionToAddPath()
        {
            var fakeReporter       = new FakeReporter();
            var osxEnvironmentPath = new OSXEnvironmentPath(
                new BashPathUnderHomeDirectory("/myhome", "executable/path"),
                fakeReporter,
                new FakeEnvironmentProvider(
                    new Dictionary <string, string>
            {
                { "PATH", "" }
            }),
                FakeFile.Empty);

            osxEnvironmentPath.PrintAddPathInstructionIfPathDoesNotExist();

            // similar to https://code.visualstudio.com/docs/setup/mac
            fakeReporter.Message.Should().Be(
                $"Cannot find the tools executable path. Please ensure /myhome/executable/path is added to your PATH.{Environment.NewLine}" +
                $"If you are using bash, You can do this by running the following command:{Environment.NewLine}{Environment.NewLine}" +
                $"cat << EOF >> ~/.bash_profile{Environment.NewLine}" +
                $"# Add .NET Core SDK tools{Environment.NewLine}" +
                $"export PATH=\"$PATH:/myhome/executable/path\"{Environment.NewLine}" +
                $"EOF");
        }