Пример #1
0
        public PermProjectionInfo CreatePermProjectionInfo(PermStorageFolderStructure folderStructure,
                                                           TempProjectionInfo tempProjectionInfo)
        {
            ValidateInputs(folderStructure.XimPath, tempProjectionInfo.Id);

            var fileName       = "proj" + tempProjectionInfo.Id + ".xim";
            var fullTargetPath = Path.Combine(folderStructure.XimPath, fileName);

            return(new PermProjectionInfo {
                FileName = fileName, FilePath = fullTargetPath, Id = tempProjectionInfo.Id
            });
        }
        public void HandleNewFile_FilesAreInQueue_QueueContainsFiles()
        {
            //Arrange:
            var projectionInfo = new TempProjectionInfo(1, "temp storage");

            _fakeProjectionInfoFactory.CreateTempProjectionInfo(Arg.Any <string>(), Arg.Any <int>())
            .Returns(projectionInfo);

            //Act:
            Task task = _uut.HandleNewFile("Some path");

            Task.WaitAll(task);

            //Assert:
            Assert.That(_queue.Count, Is.EqualTo(1));
        }
        public void HandleNewFile_FilesAreIndexed_IndexesAreCorrect()
        {
            for (int i = 0; i < 5; i++)
            {
                //Arrange:
                var projectionInfo = new TempProjectionInfo(1, "temp storage");
                _fakeProjectionInfoFactory.CreateTempProjectionInfo(Arg.Any <string>(), Arg.Any <int>())
                .Returns(projectionInfo);

                //Act:
                Task task = _uut.HandleNewFile("Some path");
                Task.WaitAll(task);

                //Assert:
                _fakeProjectionInfoFactory.Received(1).CreateTempProjectionInfo(Arg.Any <string>(), i);
            }
        }