public void Apply_Feature_Branch_Changes_Version_Resets_On_Merge()
        {
            using (var fixture = new SimpleVersionRepositoryFixture())
            {
                // Arrange
                var config = fixture.GetConfig();

                fixture.MakeACommit();
                fixture.MakeACommit();
                fixture.MakeACommit();
                fixture.MakeACommit();

                fixture.BranchTo("feature/other");
                fixture.MakeACommit();

                config.Version = "0.1.1";
                fixture.SetConfig(config);

                fixture.MakeACommit();
                fixture.MakeACommit();

                fixture.Checkout("master");
                fixture.MergeNoFF("feature/other");

                var context = new VersionContext(fixture.Repository);

                // Act
                _sut.Apply(context);

                // Assert
                context.Result.Height.Should().Be(1);
            }
        }
        public void Apply_Malformed_Json_Committed_Counts_As_No_Change()
        {
            using (var fixture = new SimpleVersionRepositoryFixture())
            {
                // Arrange
                fixture.MakeACommit();
                fixture.MakeACommit();
                fixture.MakeACommit();

                // Write the version file (with parsing errors)
                var file = Path.Combine(fixture.RepositoryPath, Constants.VersionFileName);

                using (var writer = File.AppendText(file))
                {
                    writer.WriteLine("This will not parse");
                    writer.Flush();
                }

                fixture.Repository.Index.Add(Constants.VersionFileName);
                fixture.Repository.Index.Write();
                fixture.MakeACommit(); // 5
                fixture.MakeACommit(); // 6
                fixture.MakeACommit(); // 7
                fixture.MakeACommit(); // 8

                var config = new Configuration {
                    Version = "0.1.0"
                };
                fixture.SetConfig(config);

                var context = new VersionContext(fixture.Repository);

                // Act
                _sut.Apply(context);

                context.Result.Height.Should().Be(9);
            }
        }
        public void Apply_Modfied_No_Version_Or_Label_Changes_Does_Not_Reset()
        {
            using (var fixture = new SimpleVersionRepositoryFixture())
            {
                // Arrange
                var config = fixture.GetConfig();

                fixture.MakeACommit();
                fixture.MakeACommit();
                fixture.MakeACommit();
                fixture.MakeACommit();

                config.Metadata.Add("example");
                fixture.SetConfig(config);

                var context = new VersionContext(fixture.Repository);

                // Act
                _sut.Apply(context);

                // Assert
                context.Result.Height.Should().Be(6);
            }
        }