public void Should_Throw_If_Tag_Is_Empty()
            {
                // Given
                var settings = new NpmPublishSettings();

                // When
                var result = Record.Exception(() => settings.WithTag(string.Empty));

                // Then
                result.IsArgumentNullException("tag");
            }
            public void Should_Throw_If_Source_Is_WhiteSpace()
            {
                // Given
                var settings = new NpmPublishSettings();

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

                // Then
                result.IsArgumentNullException("source");
            }
            public void Should_Throw_If_Registry_Is_Null()
            {
                // Given
                var settings = new NpmPublishSettings();

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

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

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

                // Then
                result.IsArgumentNullException("settings");
            }
            public void Should_Set_Source()
            {
                // Given
                var settings = new NpmPublishSettings();
                var source   = "foo";

                // When
                settings.FromSource(source);

                // Then
                settings.Source.ShouldBe(source);
            }
            public void Should_Set_Registry()
            {
                // Given
                var settings = new NpmPublishSettings();
                var registry = new Uri("https://example.com");

                // When
                settings.ToRegistry(registry);

                // Then
                settings.Registry.ShouldBe(registry);
            }
            public void Should_Set_Access()
            {
                // Given
                var settings = new NpmPublishSettings();
                var access   = NpmPublishAccess.Restricted;

                // When
                settings.WithAccess(access);

                // Then
                settings.Access.ShouldBe(access);
            }
            public void Should_Set_Tag()
            {
                // Given
                var settings = new NpmPublishSettings();
                var tag      = "1.2.3";

                // When
                settings.WithTag(tag);

                // Then
                settings.Tag.ShouldBe(tag);
            }
Пример #9
0
        public static void NpmPublish(this ICakeContext context, Action <NpmPublishSettings> configurator)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

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

            var settings = new NpmPublishSettings();

            configurator(settings);
            context.NpmPublish(settings);
        }
Пример #10
0
        public static void NpmPublish(this ICakeContext context, NpmPublishSettings settings)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

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

            AddinInformation.LogVersionInformation(context.Log);

            var publisher = new NpmPublisher(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools, context.Log);

            publisher.Publish(settings);
        }