public void Should_Throw_If_Scope_Is_WhiteSpace()
            {
                // Given
                var settings = new NpmAddUserSettings();

                // When
                var result = Record.Exception(() => settings.ForScope(" "));

                // Then
                result.IsArgumentNullException("scope");
            }
            public void Should_Set_AuthType_To_Legacy_Settings()
            {
                // Given
                var settings = new NpmAddUserSettings();

                // When
                settings.UsingAuthentication(AuthType.Legacy);

                // Then
                Assert.Equal(AuthType.Legacy, settings.AuthType);
            }
            public void Should_Throw_If_Settings_Are_Null()
            {
                // Given
                NpmAddUserSettings settings = null;

                // When
                var result = Record.Exception(() => settings.ForScope("@bar"));

                // Then
                result.IsArgumentNullException("settings");
            }
            public void Should_Throw_If_Settings_Are_Null()
            {
                // Given
                NpmAddUserSettings settings = null;

                // When
                var result = Record.Exception(() => settings.UsingAuthentication(AuthType.Legacy));

                // Then
                result.IsArgumentNullException("settings");
            }
            public void Should_Set_AlwaysAuth_To_True()
            {
                // Given
                var settings = new NpmAddUserSettings();

                // When
                settings.AlwaysAuthenticate();

                // Then
                Assert.True(settings.AlwaysAuth);
            }
            public void Should_Set_Scope()
            {
                // Given
                var settings = new NpmAddUserSettings();

                // When
                settings.ForScope("@bar");

                // Then
                Assert.Equal("@bar", settings.Scope);
            }
            public void Should_Throw_If_Scope_Does_Not_Start_With_At()
            {
                // Given
                var settings = new NpmAddUserSettings();

                // When
                var result = Record.Exception(() => settings.ForScope("bar"));

                // Then
                result.IsArgumentException("scope");
            }
            public void Should_Set_Registry()
            {
                // Given
                var settings = new NpmAddUserSettings();
                Uri registry = new Uri("https://myregistry.com");

                // When
                var result = settings.ForRegistry(registry);

                // Then
                result.Registry.ShouldBe(registry);
            }
            public void Should_Throw_If_Registry_Is_Null()
            {
                // Given
                var settings = new NpmAddUserSettings();
                Uri registry = null;

                // When
                var result = Record.Exception(() => settings.ForRegistry(registry));

                // Then
                result.IsArgumentNullException("registry");
            }
            public void Should_Throw_If_Settings_Are_Null()
            {
                // Given
                NpmAddUserSettings settings = null;
                Uri registry = new Uri("https://myregistry.com");

                // When
                var result = Record.Exception(() => settings.ForRegistry(registry));

                // Then
                result.IsArgumentNullException("settings");
            }
        public static void NpmAddUser(this ICakeContext context, Action <NpmAddUserSettings> configurator)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (configurator == null)
            {
                throw new ArgumentNullException(nameof(configurator));
            }

            var settings = new NpmAddUserSettings();

            configurator(settings);
            context.NpmAddUser(settings);
        }
        public static void NpmAddUser(this ICakeContext context, NpmAddUserSettings settings)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            AddinInformation.LogVersionInformation(context.Log);
            var addUser = new NpmAddUser(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools, context.Log);

            addUser.AddUser(settings);
        }