Exemplo n.º 1
0
        public void GetAllButCodecovIgnored_Should_Get_All_Source_Code_That_Is_Not_Ignored_By_Codecov()
        {
            // Given
            var versionControlSystem = Substitute.For <IVersionControlSystem>();

            versionControlSystem.SourceCode.Returns(new[] { @"C:\Fake\Class.cs", @"C:\Fake\Interface\IClass.cs", @"C:\Fake\.git" });
            var sourceCode = new Codecov.Coverage.SourceCode.SourceCode(versionControlSystem);

            // When
            var getAllButCodecovIgnored = sourceCode.GetAllButCodecovIgnored.ToList();

            // Then
            getAllButCodecovIgnored.Count.Should().Be(2);
            getAllButCodecovIgnored[0].Should().Be(@"C:\Fake\Class.cs");
            getAllButCodecovIgnored[1].Should().Be(@"C:\Fake\Interface\IClass.cs");
        }
Exemplo n.º 2
0
        public void GetAll_Should_Get_All_The_Source_Code()
        {
            // Given
            var versionControlSystem = Substitute.For <IVersionControlSystem>();

            versionControlSystem.SourceCode.Returns(new[] { @"C:\Fake\Class.cs", @"C:\Fake\Interface\IClass.cs", @"C:\Fake\.git" });
            var sourceCode = new Codecov.Coverage.SourceCode.SourceCode(versionControlSystem);

            // When
            var getAll = sourceCode.GetAll.ToList();

            // Then
            getAll.Count.Should().Be(3);
            getAll[0].Should().Be(@"C:\Fake\Class.cs");
            getAll[1].Should().Be(@"C:\Fake\Interface\IClass.cs");
            getAll[2].Should().Be(@"C:\Fake\.git");
        }
Exemplo n.º 3
0
        public void GetAllButCodecovIgnored_Should_Get_All_Source_Code_That_Is_Not_Ignored_By_Codecov()
        {
            // Given
            var allPaths = new[] {
                Path.Combine(_systemDrive, "Fake", "Class.cs"),
                Path.Combine(_systemDrive, "Fake", "Interface", "IClass.cs"),
                Path.Combine(_systemDrive, "Fake", ".git")
            };
            var versionControlSystem = Substitute.For <IVersionControlSystem>();

            versionControlSystem.SourceCode.Returns(allPaths);
            var sourceCode = new Codecov.Coverage.SourceCode.SourceCode(versionControlSystem);

            // When
            var getAllButCodecovIgnored = sourceCode.GetAllButCodecovIgnored.ToList();

            // Then
            getAllButCodecovIgnored.Should().HaveCount(2);
            getAllButCodecovIgnored.Should().Contain(allPaths.Where(p => !p.EndsWith(".git")));
        }
Exemplo n.º 4
0
        public void GetAll_Should_Get_All_The_Source_Code()
        {
            // Given
            var allPaths = new[] {
                Path.Combine(_systemDrive, "Fake", "Class.cs"),
                Path.Combine(_systemDrive, "Fake", "Interface", "IClass.cs"),
                Path.Combine(_systemDrive, "Fake", ".git")
            };
            var versionControlSystem = Substitute.For <IVersionControlSystem>();

            versionControlSystem.SourceCode.Returns(allPaths);
            var sourceCode = new Codecov.Coverage.SourceCode.SourceCode(versionControlSystem);

            // When
            var getAll = sourceCode.GetAll.ToList();

            // Then
            getAll.Should().HaveCount(3);
            getAll.Should().Contain(allPaths);
        }