Ejemplo n.º 1
0
        public void CreateHistory_throws_DuplicateFileSystemHistoryException_if_a_history_with_the_same_name_already_exists()
        {
            const string historyName = "history1";

            using(var group = CreateGroup())
            {
                var historyService = new GitBasedHistoryService(group);
                historyService.CreateHistory(historyName);

                Assert.Throws<DuplicateFileSystemHistoryException>(() => historyService.CreateHistory(historyName));
            }
        }
Ejemplo n.º 2
0
        public void CreateHistory_creates_a_new_branch_in_the_underlying_git_repository(int numberOfHistoriesToCreate)
        {
            int initialBranchCount;
            
            // get number of branches in the repository before creating the histories
            using (var repo = new Repository(m_RemotePath))
            {
                initialBranchCount = repo.Branches.Count();
            }

            using (var group = CreateGroup())
            {
                var historyService = new GitBasedHistoryService(group);

                for (var i = 0; i < numberOfHistoriesToCreate; i++)
                {
                    historyService.CreateHistory($"history-{i}");
                }
                
            }
            // Assert that the expected number of branches has been created
            using (var repo = new Repository(m_RemotePath))
            {
                Assert.Equal(numberOfHistoriesToCreate + initialBranchCount, repo.Branches.Count());
            }

        }
Ejemplo n.º 3
0
        public void CreateHistory_can_create_multiple_histories()
        {
            var historyNames = new[] { "history1", "histroy2" };

            using (var group = CreateGroup())
            {               
                var historyService = new GitBasedHistoryService(group);
                foreach (var name in historyNames)
                {
                    historyService.CreateHistory(name);
                }

            Assert.Equal(historyNames.Length, historyService.Items.Count());
            }

        }
Ejemplo n.º 4
0
        public void Indexer_Get_returns_expected_item()
        {
            using (var group = CreateGroup())
            {
                var service = new GitBasedHistoryService(group);

                service.CreateHistory("item1");

                Assert.NotNull(service["item1"]);
                Assert.NotNull(service["ITem1"]);

                // make sure the history has the name it was initially created with instead of the name it was retrieved with
                // otherwise there might be problem with pushing changes back to the master repository                
                Assert.Equal("item1", service["ITem1"].Name);
            }


        }