public void ElectronNetBuild_Should_Execute_Command_By_Given_ElectronNetBuildSettings() { ICakeContext cakeContext = _cakeContextMock.Object; var settings = new ElectronNetBuildSettings() { WorkingDirectory = "./SomeDirectory", DotNetConfig = DotNetConfig.Release, ElectronTarget = ElectronTarget.Linux, ElectronParams = new[] { "command=conquer" } }; string expectedCommand = $"{CmdBase} /target {ElectronTarget.Linux.Value} /dotnet-configuration Release /electron-params \"--command=conquer\""; var processHelperMock = new Mock <IProcessHelper>(MockBehavior.Strict); var commandBuilderMock = new Mock <ICommandBuilder>(MockBehavior.Strict); ElectronCakeContext.Current = new TestCakeContext(processHelperMock, commandBuilderMock); commandBuilderMock.Setup(builder => builder.SwitchHelper(It.Is <string[]>(strings => strings.All(s => settings.ElectronParams.Contains(s))))) .Returns(() => "--command=conquer"); processHelperMock.Setup(helper => helper.CmdExecute(It.Is <string>(s => s == expectedCommand), It.Is <string>(s => s == settings.WorkingDirectory), It.IsAny <bool>(), It.IsAny <bool>())) .Returns(1); cakeContext.ElectronNetBuild(settings); processHelperMock.Verify(helper => helper.CmdExecute(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <bool>()), Times.Once); commandBuilderMock.Verify(builder => builder.SwitchHelper(It.IsAny <string[]>()), Times.Once); }
public static int ElectronNetBuild(this ICakeContext context, ElectronNetBuildSettings settings) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } return(ElectronNetBuild(context, settings.WorkingDirectory, settings.ElectronTarget, settings.DotNetConfig, settings.RelativePath, settings.AbsolutePath, settings.PackageJson, settings.InstallModules, settings.Manifest, settings.PublishSingleFile, settings.PublishReadyToRun, settings.ElectronParams)); }