Esempio n. 1
0
            public void Should_Set_CdnProvider(CdnProvider provider)
            {
                // Given
                var settings = new LibManCacheCleanSettings();

                // When
                settings.WithProvider(provider);

                // Then
                settings.Provider.ShouldBe(provider);
            }
            public void Should_Add_CdnProvider_To_Arguments_If_Not_Null(CdnProvider provider, string expected)
            {
                // Given
                var fixture = new LibManCacheCleanToolFixture();

                fixture.Settings.Provider = provider;

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

                // Then
                Assert.Equal(expected, result.Args);
            }
            public void Should_Add_CdnProvider_To_Arguments_If_Not_Null(CdnProvider provider, string expected)
            {
                // Given
                var fixture = new LibManInstallerFixture();

                fixture.Settings.Library  = "jquery";
                fixture.Settings.Provider = provider;

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

                // Then
                Assert.Equal(expected, result.Args);
            }
Esempio n. 4
0
        /// <summary>
        /// Sets the cdn provider to clear the cache for. Does not support filesystem provider.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="provider">Cdn Provider.</param>
        /// <returns>The <paramref name="settings"/> instance with <see cref="LibManCacheCleanSettings.Provider"/> set to <paramref name="provider"/>.</returns>
        public static LibManCacheCleanSettings WithProvider(this LibManCacheCleanSettings settings, CdnProvider provider)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            if (provider == CdnProvider.filesystem)
            {
                throw new ArgumentException($"Invalid cdn Provider: {CdnProvider.filesystem}", nameof(provider));
            }

            settings.Provider = provider;
            return(settings);
        }
        /// <summary>
        /// Sets the cbn provider to retrieve the client side library from. Cannot set to Default.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="provider">Cdn Provider.</param>        
        /// <returns>The <paramref name="settings"/> instance with <see cref="LibManInstallSettings.Provider"/> set to <paramref name="provider"/>.</returns>
        public static LibManInstallSettings WithProvider(this LibManInstallSettings settings, CdnProvider provider)
        {
            if (settings == null)
                throw new ArgumentNullException(nameof(settings));

            if (provider == CdnProvider.Default)
                throw new ArgumentException($"Invalid cdn Provider: {CdnProvider.Default}", nameof(provider));

            settings.Provider = provider;
            return settings;
        }