Ejemplo n.º 1
0
        public void ChangeLogFromHgRepositoryAreAccurate()
        {
            const string repositoryName = "changeLog";

            using (TestRepository testRepository = GetRepository(repositoryName))
            {
                // Arrange
                string helloTextPath = Path.Combine(testRepository.PhysicalPath, "Hello.txt");
                var    hgRepo        = new HgRepository(testRepository.PhysicalPath, "", new MockDeploymentSettingsManager(), NullTracerFactory.Instance);

                // Act
                hgRepo.Initialize();
                File.WriteAllText(helloTextPath, "Hello world");
                hgRepo.AddFile(helloTextPath);
                hgRepo.Commit("First commit");
                File.AppendAllText(helloTextPath, "Hello again");
                hgRepo.Commit("Second commit");
                List <ChangeSet> changes = hgRepo.GetChanges().ToList();

                // Assert - 1
                Assert.Equal(2, changes.Count());
                var lastChange = changes[0];

                Assert.Equal("Second commit", lastChange.Message);
            }
        }