Esempio n. 1
0
        [Test] public void Create_Repo_Add_Files_Check_Head()
        {
            var nGit     = new API_NGit();
            var tempRepo = "_tempRepo".tempDir(true);

            "TestRepo is: {0}".info(tempRepo);
            //Creating a local temp Repo
            Assert.IsFalse(tempRepo.isGitRepository(), "Should not be a repo");
            nGit.init(tempRepo);
            Assert.IsTrue(tempRepo.isGitRepository(), "Should be a repo");
            Assert.IsNull(nGit.head());

            //Adding a file (using method 1)
            nGit.file_Create("testFile.txt", "some Text");
            nGit.add_and_Commit_using_Status();
            var head1 = nGit.head();

            Assert.IsNotNull(head1);

            //Adding another file (using method 2)
            nGit.file_Create("testFile2.txt", "some Text");
            nGit.add("testFile2.txt");
            nGit.commit("Adding Another file");

            //making sure the head has changed
            var head2 = nGit.head();

            Assert.AreNotEqual(head1, head2);

            nGit.delete_Repository_And_Files();
        }