Esempio n. 1
0
        public void ShouldCallLineCounterWithContentsOfFile(string filePath, string sourceCode)
        {
            var fileSystem = new FakeFileSystemAccessBuilder()
                             .WithReadAllTextReturning(filePath, sourceCode)
                             .Build();

            var counter = new FakeLineCounterBuilder()
                          .Build();

            var sut = CreateSut(fileSystem: fileSystem, lineCounter: counter);

            sut.Count(filePath);

            FakeLineCounterBuilder.VerifyCountWasCalledOn(counter, sourceCode);
        }
Esempio n. 2
0
        public void GivenPathWithKnownContents_ShouldReturnExpectedLines(string expectedPath, string sourceCode, int expectedLineCount)
        {
            var fileSystem = new FakeFileSystemAccessBuilder()
                             .WithReadAllTextReturning(expectedPath, sourceCode)
                             .Build();

            var counter = new FakeLineCounterBuilder()
                          .WithCountReturning(sourceCode, expectedLineCount)
                          .Build();

            var sut = CreateSut(fileSystem: fileSystem, lineCounter: counter);

            var actual = sut.Count(expectedPath);

            Assert.AreEqual(expectedLineCount, actual);
        }