public void Should_Redirect_Standard_Error()
            {
                var fixture = new NpmInstallerFixture();

                fixture.Settings.RedirectStandardError = true;

                var result = fixture.Run();

                Assert.True(result.Process.RedirectStandardError);
            }
Exemplo n.º 2
0
            public void Should_Add_Mandatory_Arguments()
            {
                // Given
                var fixture = new NpmInstallerFixture();

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("install", result.Args);
            }
Exemplo n.º 3
0
            public void Should_Throw_If_Scope_Does_Not_Start_With_At()
            {
                // Given
                var fixture = new NpmInstallerFixture();

                // When
                var result = Record.Exception(() => fixture.Settings.AddScopedPackage("foo", "bar"));

                // Then
                Assert.IsType <ArgumentException>(result);
            }
Exemplo n.º 4
0
            public void Should_Add_Scoped_Package_To_Arguments()
            {
                // Given
                var fixture = new NpmInstallerFixture();

                fixture.Settings.AddScopedPackage("foo", "@bar");

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("install @bar/foo", result.Args);
            }
Exemplo n.º 5
0
            public void Should_Add_Package_With_Tag_Containing_Space_To_Arguments()
            {
                // Given
                var fixture = new NpmInstallerFixture();

                fixture.Settings.AddPackage("foo", "bar bla");

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("install foo@\"bar bla\"", result.Args);
            }
Exemplo n.º 6
0
            public void Should_Throw_If_Settings_Are_Null()
            {
                // Given
                var fixture = new NpmInstallerFixture();

                fixture.Settings = null;

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                result.IsArgumentNullException("settings");
            }
            public void Should_Not_Add_Registry_To_Arguments_If_Not_Set()
            {
                // Given
                var fixture = new NpmInstallerFixture();

                fixture.Settings.Registry = null;

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("install", result.Args);
            }
            public void Should_Add_NoOptional_To_Arguments_If_Specified()
            {
                // Given
                var fixture = new NpmInstallerFixture();

                fixture.Settings.NoOptional = true;

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("install --no-optional", result.Args);
            }
Exemplo n.º 9
0
            public void Should_Add_Production_To_Arguments_If_Not_Null()
            {
                // Given
                var fixture = new NpmInstallerFixture();

                fixture.Settings.Production = true;

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("install --production", result.Args);
            }
Exemplo n.º 10
0
            public void Should_Add_Package_With_Version_To_Arguments()
            {
                // Given
                var fixture = new NpmInstallerFixture();

                fixture.Settings.AddPackage("foo", "1.2.3");

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("install [email protected]", result.Args);
            }
Exemplo n.º 11
0
            public void Should_Add_Package_Url_To_Arguments()
            {
                // Given
                var fixture = new NpmInstallerFixture();

                fixture.Settings.AddPackage(new Uri("https://www.example.com/mypackage.tgz"));

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("install https://www.example.com/mypackage.tgz", result.Args);
            }
Exemplo n.º 12
0
            public void Should_Throw_If_Not_Absolute_Uri()
            {
                // Given
                var fixture = new NpmInstallerFixture();

                // When
                var result = Record.Exception(
                    () =>
                    fixture.Settings.AddPackage(
                        new Uri("https://www.example.com/foo/mypackage.tgz").MakeRelativeUri(new Uri("https://www.example.com"))));

                // Then
                Assert.IsType <UriFormatException>(result);
            }
            public void Should_Add_Registry_To_Arguments_If_Set()
            {
                // Given
                var fixture  = new NpmInstallerFixture();
                var registry = new Uri("http://exampleregistry.com");

                fixture.Settings.Registry = registry;

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal($"install --registry { registry }", result.Args);
            }
Exemplo n.º 14
0
            public void Should_Throw_If_Production_Is_Used_Together_With_Packages()
            {
                // Given
                var fixture = new NpmInstallerFixture();

                fixture.Settings.Production = true;
                fixture.Settings.Packages.Add("foo");

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                Assert.IsType <NotSupportedException>(result);
            }
Exemplo n.º 15
0
            public void Should_Use_Cake_LogLevel_If_LogLevel_Is_Set_To_Default(
                Verbosity verbosity,
                string expected)
            {
                // Given
                var fixture = new NpmInstallerFixture();

                fixture.Settings.CakeVerbosityLevel = verbosity;

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal(expected, result.Args);
            }
Exemplo n.º 16
0
            public void Should_Add_LogLevel_To_Arguments_If_Not_Null(
                NpmLogLevel logLevel,
                string expected)
            {
                // Given
                var fixture = new NpmInstallerFixture();

                fixture.Settings.LogLevel = logLevel;

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal(expected, result.Args);
            }
Exemplo n.º 17
0
            public void Should_Pass_In_Arbitrary_Npm_Arguments(string[] npmArgs, string expected)
            {
                // Given
                var fixture = new NpmInstallerFixture();

                foreach (var npmArg in npmArgs)
                {
                    fixture.Settings.WithNpmArguments(npmArg);
                }

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal(expected, result.Args);
            }