예제 #1
0
            public void Given_One_New_Line_Added_In_One_Old_File_Expect_Old_Code_Base_Impact()
            {
                //---------------Arrange------------------
                var commit = new Commit
                {
                    Author = new Author
                    {
                        Name   = "T-rav",
                        Emails = new List <string> {
                            "*****@*****.**"
                        }
                    },
                    When  = DateTime.Now,
                    Patch = new List <Patch>
                    {
                        new Patch
                        {
                            Contents     = "@@ 1,0 1,0 @@ namespace Test.Namespace \na",
                            LinesAdded   = 1,
                            LinesRemoved = 0,
                            ChangeType   = ChangeType.Modified
                        }
                    }
                };
                var sut = new CommitStat(commit);
                //---------------Act----------------------
                var actual = sut.Impact(new List <string>(), false);
                //---------------Assert-------------------
                var expectedImpact = 0.0015;

                actual.Should().Be(expectedImpact);
            }
예제 #2
0
            public void Given_No_Change_Expect_Zero_Impact()
            {
                //---------------Arrange------------------
                var commit = new Commit
                {
                    Author = new Author
                    {
                        Name   = "T-rav",
                        Emails = new List <string> {
                            "*****@*****.**"
                        }
                    },
                    When  = DateTime.Now,
                    Patch = new List <Patch>
                    {
                        new Patch
                        {
                            Contents     = string.Empty,
                            LinesAdded   = 0,
                            LinesRemoved = 0
                        }
                    }
                };
                var sut = new CommitStat(commit);
                //---------------Act----------------------
                var actual = sut.Impact(new List <string>(), false);

                //---------------Assert-------------------
                actual.Should().Be(0);
            }