public void Execute_ShouldUseDefaultValues_WhenNoInputIsGiven() { var factory = Container.Resolve <IGitDependFileFactory>(); var console = Container.Resolve <IConsole>(); var fileSystem = Container.Resolve <IFileSystem>(); var config = new GitDependFile(); string dir = Lib1Directory; ReturnCode loadCode = ReturnCode.Success; factory.Arrange(f => f.LoadFromDirectory(Arg.AnyString, out dir, out loadCode)) .Returns(config); fileSystem.Arrange(f => f.File.WriteAllText(Arg.AnyString, Arg.AnyString)) .MustBeCalled(); int index = 0; string[] responses = { "", "" }; console.Arrange(c => c.ReadLine()) .Returns(() => responses[index++]); var options = new InitSubOptions(); var instance = new InitCommand(options); var code = instance.Execute(); Assert.AreEqual(ReturnCode.Success, code, "Invalid Return Code"); fileSystem.Assert("WriteAllText should have been caleld"); Assert.AreEqual("make.bat", config.Build.Script, "Invalid Build Script"); Assert.AreEqual("artifacts/NuGet/Debug", config.Packages.Directory, "Invalid Packages Directory"); }
public void TestInit_Interactive() { TestInputReader reader = HostEnvironment.InputReader as TestInputReader; reader.Inputs.Add("DefaultProvider", "cdnjs"); reader.Inputs.Add("DefaultDestination:", "wwwroot"); InitCommand command = new InitCommand(HostEnvironment); command.Configure(null); int result = command.Execute(); Assert.AreEqual(0, result); string libmanFilePath = Path.Combine(WorkingDir, HostEnvironment.EnvironmentSettings.ManifestFileName); Assert.IsTrue(File.Exists(libmanFilePath)); string contents = File.ReadAllText(libmanFilePath); string expectedContents = @"{ ""version"": ""1.0"", ""defaultProvider"": ""cdnjs"", ""libraries"": [] }"; Assert.AreEqual(StringHelper.NormalizeNewLines(expectedContents), StringHelper.NormalizeNewLines(contents)); }
/// <summary> /// Initializes a new instance for the <see cref="AddContactViewModel" /> class. /// </summary> public ServisAddContactViewModel(INavigation navigation, Model.Requests.ServisOdaberiTerminRequest request) { NaciniPlacanjaListHeight = NaciniPlacanja.Count * 112; this.SubmitCommand = new Command(this.SubmitButtonClicked); this.InitCommand = new Command(async() => await this.Init()); InitCommand.Execute(null); this.Navigation = navigation; Request = request; DetaljiListViewHeight = Request.Kolicina * 265; var TipoviList = new ObservableCollection <string>(); foreach (Model.Tip item in Enum.GetValues(typeof(Model.Tip))) { TipoviList.Add(item.ToString()); } for (int i = 0; i < Request.Kolicina; i++) { DetaljiServisa.Add(new DetaljiServisaMobile() { DetaljiText = "Detalji bicikla " + (i + 1) + " za servis", TipoviBicikala = TipoviList }); } }
public void TestInit_UseDefault() { HostEnvironment.EnvironmentSettings.DefaultProvider = "unpkg"; InitCommand command = new InitCommand(HostEnvironment); command.Configure(null); int result = command.Execute("-y"); Assert.AreEqual(0, result); string libmanFilePath = Path.Combine(WorkingDir, HostEnvironment.EnvironmentSettings.ManifestFileName); Assert.IsTrue(File.Exists(libmanFilePath)); string contents = File.ReadAllText(libmanFilePath); string expectedContents = @"{ ""version"": ""1.0"", ""defaultProvider"": ""unpkg"", ""libraries"": [] }"; Assert.AreEqual(StringHelper.NormalizeNewLines(expectedContents), StringHelper.NormalizeNewLines(contents)); }
public LoadingWindowViewModel(Window window) { _window = window; InitCommand = ReactiveCommand.Create(Init); InitCommand.Execute().Subscribe(); }
public Application() { List<Book> books = new List<Book> (); books.Add(new Book ("Object Thinking","Dr.David West",1990,"ISBN1990")); books.Add(new Book ("Cakes, Puddings + Category Theory","a",2015,"ISBN2015")); Biblotica app = new Biblotica (books); InputParser parser = new InputParser (app); _shouldContinue = true; ConsoleView view = new ConsoleView (); InitCommand startCommand = new InitCommand (); startCommand.Execute (); startCommand.WriteResultDataToView (view); while(_shouldContinue) { Console.WriteLine ("Input:"); string input = Console.ReadLine (); ICommand command = parser.Parse (input); if (command is ExitCommand) { _shouldContinue = false; } command.Execute(); command.WriteResultDataToView(view); } }
public void Execute(string folderName) { using (new WithCurrentDirectory(folderName)) { var command = new InitCommand(@"C:\Program Files\Git\bin\git.exe"); command.Execute(); } }
/// <summary> /// Initializes a new instance for the <see cref="AddContactViewModel" /> class. /// </summary> public IznajmiAddContactViewModel(INavigation navigation) { NaciniPlacanjaListHeight = NaciniPlacanja.Count * 112; this.SubmitCommand = new Command(this.SubmitButtonClicked); this.InitCommand = new Command(async() => await this.Init()); InitCommand.Execute(null); this.Navigation = navigation; }
public void CreateRepository(Project project) { var cmd = new InitCommand { GitDirectory = Path.Combine(GitSettings.RepositoriesPath, project.Name), Quiet = false, Bare = true }; cmd.Execute(); }
public void Execute_ShouldReturnError_WhenGitDependFileCannotBeLoaded() { var factory = Container.Resolve <IGitDependFileFactory>(); string dir; ReturnCode loadCode = ReturnCode.GitRepositoryNotFound; factory.Arrange(f => f.LoadFromDirectory(Arg.AnyString, out dir, out loadCode)) .Returns(null as GitDependFile); var options = new InitSubOptions(); var instance = new InitCommand(options); var code = instance.Execute(); Assert.AreEqual(ReturnCode.GitRepositoryNotFound, code, "Invalid Return Code"); }
async Task Ponisti() { RSII25092020SearchRequest search = new RSII25092020SearchRequest(); search.KupacId = SelectedKupac.KupacId; search.PotencijalnoMaliciozan = false; var list = await _RSIIService.Get <List <RSII25092020> >(search); foreach (var rsii in list) { RSII25092020InsertRequest unosNovog = new RSII25092020InsertRequest(); unosNovog.DatumLogiranja = rsii.DatumLogiranja; unosNovog.KupacId = rsii.KupacId; unosNovog.PotencijalnoMaliciozan = true; await _RSIIService.Update <RSII25092020InsertRequest>(rsii.Rsid, unosNovog); } InitCommand.Execute(null); }
public override void Run(string[] args) { cmd.Quiet = false; // [henon] the api defines the commands quiet by default. thus we need to override with git's default here. options = new CmdParserOptionSet { { "bare", "Create a bare repository", v => cmd.Bare = true }, { "quiet|q", "Only print error and warning messages, all other output will be suppressed.", v => cmd.Quiet = true }, { "template", "Not supported.", var => OutputStream.WriteLine("--template=<template dir> is not supported") }, { "shared", "Not supported.", var => OutputStream.WriteLine("--shared is not supported") }, }; try { List <String> arguments = ParseOptions(args); cmd.Execute(); } catch (Exception e) { cmd.OutputStream.WriteLine(e.Message); } }
public void Init() { //Initializing a new repository in the current directory (if GID_DIR environment variable is not set) Git.Init("."); //Initializing a new repository in the specified location Git.Init("path/to/repo"); //Initializing a new repository with options var cmd = new InitCommand { GitDirectory ="path/to/repo", Quiet = false, Bare = true }; cmd.Execute(); }
void execute() { var cmd = new InitCommand(); cmd.Execute(theInput); }
public static void Init(InitCommand command) { command.Execute(); }
/// <summary> /// Initializes a repository in the current location using the provided git command's options. /// </summary> /// <param name="cmd"></param> /// <returns></returns> public static Repository Init(InitCommand cmd) { cmd.Execute(); return cmd.Repository; }
public void InitCommand_Should_Notify_Initialization_With_Welcome_Message() { InitCommand command = new InitCommand (); CommandResult result = command.Execute (); Assert.AreEqual ("Welcome", result.Data); }