public void It_creates_a_pdb_reader_right_away()
        {
            var pdbReaderFactoryMock = new Mock<IPdbReaderFactory>();
            var sourceInformationProvider = new SourceInformationProvider(_pdbPath, null, pdbReaderFactoryMock.Object);

            pdbReaderFactoryMock.Verify(p => p.Create(_pdbPath), Times.Once);
        }
        public void It_disposes_of_the_reader_when_it_gets_disposed()
        {
            var pdbReaderMock = new Mock<IPdbReader>();

            var pdbReaderFactoryMock = new Mock<IPdbReaderFactory>();
            pdbReaderFactoryMock.Setup(p => p.Create(_pdbPath)).Returns(pdbReaderMock.Object);

            using (var sourceInformationProvider =
                new SourceInformationProvider(_pdbPath, null, pdbReaderFactoryMock.Object))
            {
            }

            pdbReaderMock.Verify(p => p.Dispose(), Times.Once);
        }
        public void It_uses_the_reader_to_get_the_SourceInformation()
        {
            var type = typeof(GivenThatWeWantToUseSourceInformationProviderToGetSourceInformation);
            var methodInfo = type.GetMethod("It_uses_the_reader_to_get_the_SourceInformation");

            var expectedSourceInformation = new SourceInformation("some file path.cs", 12);
            var pdbReaderMock = new Mock<IPdbReader>();
            pdbReaderMock.Setup(p => p.GetSourceInformation(methodInfo)).Returns(expectedSourceInformation);

            var pdbReaderFactoryMock = new Mock<IPdbReaderFactory>();
            pdbReaderFactoryMock.Setup(p => p.Create(_pdbPath)).Returns(pdbReaderMock.Object);

            var sourceInformationProvider = new SourceInformationProvider(_pdbPath, null, pdbReaderFactoryMock.Object);

            var actualSourceInformation = sourceInformationProvider.GetSourceInformation(methodInfo);

            actualSourceInformation.Should().Be(expectedSourceInformation);
        }