コード例 #1
0
        public void GitClone_ThrowNameConflictException()
        {
            var uri = new Uri(Environment.CurrentDirectory);
            var repositoryAddress = "";

            _gitRepositoryAccess = new GitRepositoryAccess(uri);

            Action testCode = () => _gitRepositoryAccess.Clone(repositoryAddress);

            Assert.Throws <NameConflictException>(testCode);
        }
コード例 #2
0
        public void GitClone_Clone_OK()
        {
            var testDirectoryPath = Environment.CurrentDirectory + $"\\{Guid.NewGuid().ToString()}";

            Directory.CreateDirectory(testDirectoryPath);

            var uri = new Uri(testDirectoryPath);
            var repositoryAddress = "https://github.com/programistadoswiadczony/PythonWebApi.git";

            _gitRepositoryAccess = new GitRepositoryAccess(uri);

            //act
            _gitRepositoryAccess.Clone(repositoryAddress);

            Assert.True(Directory.GetFiles(testDirectoryPath).Any());
        }
コード例 #3
0
        public void GtiCheckout_CheckoutProperBranch_OK()
        {
            var testDirectoryPath = Environment.CurrentDirectory + $"\\{Guid.NewGuid().ToString()}";

            Directory.CreateDirectory(testDirectoryPath);

            var uri = new Uri(testDirectoryPath);
            var repositoryAddress = "https://github.com/programistadoswiadczony/PythonWebApi.git";

            _gitRepositoryAccess = new GitRepositoryAccess(uri);

            _gitRepositoryAccess.Clone(repositoryAddress);
            var branchName = "master";

            //act
            _gitRepositoryAccess.Checkout(branchName);

            Assert.NotNull(_gitRepositoryAccess.CheckoutedBranch);
            Assert.Equal("HEAD", _gitRepositoryAccess.CheckoutedBranch.Reference.CanonicalName);
        }