Exemple #1
0
            public void Should_Throw_If_Value_Is_Null()
            {
                // Given
                var settings = new NpmSetSettings();

                // When
                var result = Record.Exception(() => settings.WithValue(null));

                // Then
                result.IsArgumentNullException("value");
            }
Exemple #2
0
            public void Should_Throw_If_Settings_Are_Null()
            {
                // Given
                NpmSetSettings settings = null;

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

                // Then
                result.IsArgumentNullException("settings");
            }
Exemple #3
0
            public void Should_Throw_If_Key_Is_WhiteSpace()
            {
                // Given
                var settings = new NpmSetSettings();

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

                // Then
                result.IsArgumentNullException("key");
            }
Exemple #4
0
            public void Should_Set_Key()
            {
                // Given
                var settings = new NpmSetSettings();
                var key      = "foo";

                // When
                settings.ForKey(key);

                // Then
                settings.Key.ShouldBe(key);
            }
Exemple #5
0
            public void Should_Set_Value()
            {
                // Given
                var settings = new NpmSetSettings();
                var value    = "foo";

                // When
                settings.WithValue(value);

                // Then
                settings.Value.ShouldBe(value);
            }
Exemple #6
0
        public static void NpmSet(this ICakeContext context, NpmSetSettings settings)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

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

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

            tool.Set(settings);
        }
Exemple #7
0
        public static void NpmSet(this ICakeContext context, Action <NpmSetSettings> configurator)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

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

            var settings = new NpmSetSettings();

            configurator(settings);
            context.NpmSet(settings);
        }