コード例 #1
0
ファイル: InitCommandTests.cs プロジェクト: pdubb29/GitDepend
        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");
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        /// <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
                });
            }
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        public LoadingWindowViewModel(Window window)
        {
            _window     = window;
            InitCommand = ReactiveCommand.Create(Init);

            InitCommand.Execute().Subscribe();
        }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
 public void Execute(string folderName)
 {
     using (new WithCurrentDirectory(folderName))
     {
         var command = new InitCommand(@"C:\Program Files\Git\bin\git.exe");
         command.Execute();
     }
 }
コード例 #8
0
 /// <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;
 }
コード例 #9
0
 public void CreateRepository(Project project)
 {
     var cmd = new InitCommand
     {
         GitDirectory = Path.Combine(GitSettings.RepositoriesPath, project.Name),
         Quiet = false,
         Bare = true
     };
     cmd.Execute();
 }
コード例 #10
0
ファイル: InitCommandTests.cs プロジェクト: pdubb29/GitDepend
        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");
        }
コード例 #11
0
        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);
        }
コード例 #12
0
ファイル: Init.cs プロジェクト: kkl713/GitSharp
        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);
            }
        }
コード例 #13
0
ファイル: Examples.cs プロジェクト: dev218/GitSharp
        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();
        }
コード例 #14
0
        void execute()
        {
            var cmd = new InitCommand();

            cmd.Execute(theInput);
        }
コード例 #15
0
ファイル: Git.cs プロジェクト: dev218/GitSharp
 public static void Init(InitCommand command)
 {
     command.Execute();
 }
コード例 #16
0
ファイル: Repository.cs プロジェクト: ermshiperete/GitSharp
 /// <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;
 }
コード例 #17
0
 void execute()
 {
     var cmd = new InitCommand();
     cmd.Execute(theInput);
 }
コード例 #18
0
 public void InitCommand_Should_Notify_Initialization_With_Welcome_Message()
 {
     InitCommand command = new InitCommand ();
     CommandResult result = command.Execute ();
     Assert.AreEqual ("Welcome", result.Data);
 }