public void CreateProperlyFileInDb_Test()
        {
            // Arrange
            ArrangeMocks();
            _dataAccess = MockRepository.GenerateMock<IDataAccess>();
            var service = new ScanningService(_lineProcessor, _dataAccess, _fileReader);

            var actualCreatedFilePath = string.Empty;
            _dataAccess.Expect(x => x.GetFile(Arg<string>.Is.Anything)).WhenCalled(x =>
                                    {
                                        actualCreatedFilePath = (string) x.Arguments[0];
                                    })
                                    .Return(GetTestFileEntity(_testPath));

            _dataAccess.Expect(x => x.SaveWords(Arg<IEnumerable<string>>.Is.Anything)).Return(GetSaveWordsResult());
            _dataAccess.Expect(x => x.AddWordEntries(Arg<List<WEntry>>.Is.Anything));

            // Act
            var actualResult = service.AddScanningFile(_testPath, _token);
            actualResult.Wait(_token);

            // Assert
            _dataAccess.VerifyAllExpectations();
            Assert.AreEqual(_testPath, actualCreatedFilePath);
        }
        public void ProcessProperlyLines_Test()
        {
            // Arrange
            ArrangeMocks();

            _lineProcessor = MockRepository.GenerateMock<ILineProcessor>();
            var service = new ScanningService(_lineProcessor, _dataAccess, _fileReader);

            var actualLines = new List<string>();
            _lineProcessor.Expect(x => x.Process(Arg<string>.Is.Anything))
                .Repeat.Twice().WhenCalled(x => actualLines.Add((string)x.Arguments[0]))
                .Return(GetLineProcessorWorkResult());

            // Act
            var actualResult = service.AddScanningFile(_testPath, _token);
            actualResult.Wait(_token);

            // Assert
            _lineProcessor.VerifyAllExpectations();

            Assert.AreEqual(2, actualLines.Count);
            actualLines.ForEach(x => Assert.AreEqual(_testLine, x));
        }
        public void ReadProperlyFile_Test()
        {
            // Arrange
            ArrangeMocks();

            _fileReader = MockRepository.GenerateMock<IFileReader>();
            var service = new ScanningService(_lineProcessor, _dataAccess, _fileReader);

            var actualPath = string.Empty;
            _fileReader.Expect(x => x.ReadByLine(Arg<string>.Is.Anything)).Return(_lines).WhenCalled(x =>
                                                            {
                                                                actualPath = (string)x.Arguments[0];
                                                            });

            // Act
            var actualResult = service.AddScanningFile(_testPath, _token);
            actualResult.Wait(_token);

            // Assert
            _fileReader.VerifyAllExpectations();
            Assert.AreEqual(_testPath, actualPath);
        }