public void Should_Throw_If_Settings_Are_Null() { // Given NpmRebuildSettings settings = null; // When var result = Record.Exception(() => settings.AddPackage("foo")); // Then result.IsArgumentNullException("settings"); }
public void Should_Throw_If_Package_Is_WhiteSpace() { // Given var settings = new NpmRebuildSettings(); // When var result = Record.Exception(() => settings.AddPackage(" ")); // Then result.IsArgumentNullException("packageName"); }
public void Should_Add_Package() { // Given var settings = new NpmRebuildSettings(); var packageName = "foo"; // When settings.AddPackage(packageName); // Then settings.Packages.Count.ShouldBe(1); settings.Packages.ShouldContain(packageName); }
public static void NpmRebuild(this ICakeContext context, params string[] packages) { if (context == null) { throw new ArgumentNullException(nameof(context)); } var settings = new NpmRebuildSettings(); foreach (var packageName in packages) { if (!string.IsNullOrWhiteSpace(packageName)) { settings.AddPackage(packageName); } } context.NpmRebuild(settings); }