public void SetUp()
        {
            _blobId = new BlobId(_originalFormat, 1);
            _pathToTask = Path.Combine(TestConfig.QueueFolder, "File_1.dsimport");
            _fileToImport = Path.Combine(TestConfig.QueueFolder, "A Word Document.docx");
            ClearQueueTempFolder();
            Directory.CreateDirectory(TestConfig.QueueFolder);
            File.Copy(Path.Combine(TestConfig.DocumentsFolder, "Queue\\File_1.dsimport"), _pathToTask);
            File.Copy(TestConfig.PathToWordDocument, _fileToImport);
            var accessor = Substitute.For<ITenantAccessor>();
            var tenant = Substitute.For<ITenant>();
            tenant.Id.Returns(new TenantId("tests"));
            var container = Substitute.For<IWindsorContainer>();
            _commandBus = Substitute.For<ICommandBus>();
            var identityGenerator = Substitute.For<IIdentityGenerator>();

            _blobstore = Substitute.For<IBlobStore>();
            _blobstore.Upload(Arg.Is(_originalFormat), Arg.Any<string>()).Returns(_blobId);
            _blobstore.Upload(Arg.Is(_originalFormat), Arg.Any<FileNameWithExtension>(), Arg.Any<Stream>()).Returns(_blobId);

            accessor.GetTenant(_testTenant).Returns(tenant);
            accessor.Current.Returns(tenant);
            tenant.Container.Returns(container);

            container.Resolve<IBlobStore>().Returns(_blobstore);
            container.Resolve<IIdentityGenerator>().Returns(identityGenerator);
            container.Resolve<IMongoDatabase>().Returns(MongoDbTestConnectionProvider.ReadModelDb);
            var collection = MongoDbTestConnectionProvider.ReadModelDb.GetCollection<ImportFailure>("sys.importFailures");
            collection.Drop();
            DocumentStoreTestConfiguration config = new DocumentStoreTestConfiguration(tenantId : "tests");
            config.SetFolderToMonitor(TestConfig.QueueFolder);
            var sysDb = config.TenantSettings.Single(t => t.TenantId == "tests").Get<IMongoDatabase>("system.db");
            sysDb.Drop();
            _queue = new ImportFormatFromFileQueue(config, accessor, _commandBus)
            {
                Logger = new ConsoleLogger()
            };

            _queue.DeleteTaskFileAfterImport = false;
        }
 public ImportFileFromFileSystemRunner(ImportFormatFromFileQueue job)
 {
     _job = job;
 }
 public ImportFileFromFileSystemRunner(ImportFormatFromFileQueue job)
 {
     _job = job;
 }