public void Should_Throw_If_Scope_Does_Not_Start_With_At_Symbol() { // Given NpmPruneSettings settings = new NpmPruneSettings(); // When var result = Record.Exception(() => settings.AddPackage("test", "badscope")); // Then result.IsArgumentException("scope"); }
public void Should_Add_PackageName_To_Packages() { // Given NpmPruneSettings settings = new NpmPruneSettings(); // When settings.AddPackage("test"); // Then settings.Packages.ShouldContain("test"); }
public void Should_Throw_If_Settings_Are_Null() { // Given NpmPruneSettings settings = null; // When var result = Record.Exception(() => settings.AddPackage("test")); // Then result.IsArgumentNullException("settings"); }
public void Should_Throw_If_PackageName_Is_Null_Or_Whitespace(string packageName) { // Given NpmPruneSettings settings = new NpmPruneSettings(); // When var result = Record.Exception(() => settings.AddPackage(packageName)); // Then result.IsArgumentNullException("packageName"); }
public void Should_Set_Production_Flag_True_() { // Given NpmPruneSettings settings = new NpmPruneSettings(); // When settings.ForProduction(); // Then settings.Production.ShouldBe(true); }
public void Should_Set_DryRun_Flag_True_() { // Given NpmPruneSettings settings = new NpmPruneSettings(); // When settings.DryRun(); // Then settings.DryRun.ShouldBe(true); }
public void Should_Set_Production_Flag_False() { // Given NpmPruneSettings settings = new NpmPruneSettings() { Production = true }; // When settings.ForProduction(false); // Then settings.Production.ShouldBe(false); }
public void Should_Set_Json_Flag_False() { // Given NpmPruneSettings settings = new NpmPruneSettings() { Json = true }; // When settings.Json(false); // Then settings.Json.ShouldBe(false); }
public void Should_Set_DryRun_Flag_False() { // Given NpmPruneSettings settings = new NpmPruneSettings() { DryRun = true }; // When settings.DryRun(false); // Then settings.DryRun.ShouldBe(false); }
public static void NpmPrune(this ICakeContext context, Action <NpmPruneSettings> configurator) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (configurator == null) { throw new ArgumentNullException(nameof(configurator)); } var settings = new NpmPruneSettings(); configurator(settings); context.NpmPrune(settings); }
public static void NpmPrune(this ICakeContext context, NpmPruneSettings settings) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } AddinInformation.LogVersionInformation(context.Log); var pruner = new NpmPruneRunner(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools, context.Log); pruner.Prune(settings); }