Esempio n. 1
0
        public void ShouldHaveGoodName()
        {
            Globals globals = new Globals();

            globals.Repository = mocks.Get <IGitRepository>();
            globals.Repository.Stub(t => t.AssertValidBranchName("")).IgnoreArguments().Do((Func <string, string>) delegate(string value) { return(value); });

            var initBranch4test = new InitBranchForTest(new StringWriter(), globals, null, null);

            Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("test"));
            Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("te^st"));
            Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("te~st"));
            Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("te st"));
            Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("te:st"));
            Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("te*st"));
            Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("te?st"));
            Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("te[st"));
            Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("test/"));
            Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("test."));
            Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("$/repo/te:st"));
            Assert.Equal("test/test2", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("$/repo/te:st/test2"));
            Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("te..st"));
            Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("test."));
            Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("te\\st."));
            Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("te@{st."));
        }
Esempio n. 2
0
        public void ShouldHaveGoodName()
        {
            Globals globals = new Globals();
               globals.Repository = mocks.Get<IGitRepository>();
               globals.Repository.Stub(t => t.AssertValidBranchName("")).IgnoreArguments().Do ( (Func<string, string>) delegate (string value) { return value; });

               var initBranch4test = new InitBranchForTest(new StringWriter(), globals , null, null);
               Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("test"));
               Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("te^st"));
               Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("te~st"));
               Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("te st"));
               Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("te:st"));
               Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("te*st"));
               Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("te?st"));
               Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("te[st"));
               Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("test/"));
               Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("test."));
               Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("$/repo/te:st"));
               Assert.Equal("test/test2", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("$/repo/te:st/test2"));
               Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("te..st"));
               Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("test."));
               Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("te\\st."));
               Assert.Equal("test", initBranch4test.ExtractGitBranchNameFromTfsRepositoryPath("te@{st."));
        }