Ejemplo n.º 1
0
 public StashViewModel(IGitStashWrapper wrapper, IGitStash stash, ITeamExplorerBase page, Translator T)
 {
     this.page             = page;
     this.Stash            = stash;
     this.wrapper          = wrapper;
     this.T                = T;
     PopDropDownCommand    = new RelayCommand(p => OnClickPopStash(), p => AlwaysTrueCanDropDown);
     ApplyDropDownCommand  = new RelayCommand(p => OnClickApplyStash(), p => AlwaysTrueCanDropDown);
     DeleteDropDownCommand = new RelayCommand(p => OnClickDropStash(), p => AlwaysTrueCanDropDown);
 }
Ejemplo n.º 2
0
        public void TestStashesReturnsTheProperIndex()
        {
            FileStream fs = File.Create(@"testgit\file2");

            fs.Close();

            GitStashWrapper git     = new GitStashWrapper("testgit", GetEventService(), GetLogger(), GetProjects(), T);
            GitStashOptions options = new GitStashOptions {
                Untracked = true
            };

            options.Message = "one";
            IGitStashResults results = git.SaveStash(options);

            Assert.IsTrue(results.Success);
            Assert.IsTrue(git.Stashes.Count == 1);
            Assert.IsFalse(File.Exists("file2"));

            fs = File.Create(@"testgit\file2");
            fs.Close();

            options.Message = "two";
            results         = git.SaveStash(options);

            Assert.IsTrue(results.Success);
            Assert.IsTrue(git.Stashes.Count == 2);
            Assert.IsFalse(File.Exists("file2"));

            IGitStash recent = git.Stashes[0];
            IGitStash older  = git.Stashes[1];

            Assert.IsTrue(recent.Index == 0);
            Assert.IsTrue(recent.Message == "two");

            Assert.IsTrue(older.Index == 1);
            Assert.IsTrue(older.Message == "one");
        }