コード例 #1
0
        public List <FileInfoCollector.FileInformations> GetFileInfoLogFromPath(string path)
        {
            //TODO: unit test this
            var infoLines = _lfg.GetInfoLinesFromLog(path);

            return(_il2fi.ConvertAll(infoLines));
        }
コード例 #2
0
        public void GetInfoLinesShouldThrowExceptionIfFileDoesntExists()
        {
            var fslMock = new Mock <IFilesystemLayer>();

            fslMock.Setup(m => m.GetStringLinesOfFile(It.IsAny <string>())).Throws(new FileSystemLayerFileNotFoundException());
            Mock <ILogFileNameProvider> lfnp = SetupLFNPMock();
            var lfg = new LogFileGatherer(fslMock.Object, lfnp.Object);

            var result = lfg.GetInfoLinesFromLog("dummy");
        }
コード例 #3
0
        public void GetInfoLinesShouldReturnEmptyListIfInputIsEmpty()
        {
            var fslMock = new Mock <IFilesystemLayer>();

            fslMock.Setup(m => m.GetStringLinesOfFile(It.IsAny <string>())).Returns(new string[] {});
            Mock <ILogFileNameProvider> lfnp = SetupLFNPMock();
            var lfg = new LogFileGatherer(fslMock.Object, lfnp.Object);

            var result = lfg.GetInfoLinesFromLog("dummy");

            Assert.IsInstanceOfType(result, typeof(List <string>));
            Assert.IsTrue(result.Count == 0);
        }
コード例 #4
0
        public void GetInfoLinesShouldConvertInputIntoList()
        {
            var          fslMock = new Mock <IFilesystemLayer>();
            const string line1   = "line1";
            const string line2   = "line2";

            fslMock.Setup(m => m.GetStringLinesOfFile(It.IsAny <string>())).Returns(new string[] { line1, line2 });
            Mock <ILogFileNameProvider> lfnp = SetupLFNPMock();
            var lfg = new LogFileGatherer(fslMock.Object, lfnp.Object);

            var result = lfg.GetInfoLinesFromLog("dummy");

            Assert.IsInstanceOfType(result, typeof(List <string>));
            Assert.IsTrue(result.Count == 2);
            Assert.AreEqual(result[0], line1);
            Assert.AreEqual(result[1], line2);
        }