/// <summary> /// Returns the instance of MessageHandler. /// </summary> /// <param name="handlerName">MessageHandler Enumeration value.</param> /// <returns>IMessageHandler Instance.</returns> public IMessageHandler GetMessageHandler(MessageHandlerEnum handlerName) { IMessageHandler messageHandler = null; switch (handlerName) { case MessageHandlerEnum.PublishMessageHandler: messageHandler = new PublishQueueService(this.fileServiceFactory, this.repositoryService, this.queueRepository); break; case MessageHandlerEnum.VerifyMessageHandler: messageHandler = new VerifyFileQueueService(this.fileServiceFactory, this.repositoryService, this.queueRepository, this.blobRepository); break; } return messageHandler; }
/// <summary> /// Reuturns the VerifyFileQueueService instance. /// </summary> /// <returns>VerifyFileQueueService instance.</returns> private VerifyFileQueueService GetVerifyFileQueueService() { this.fileService = new StubIFileService() { CheckIfFileExistsOnExternalRepositoryVerifyFileMessage = (message) => { return OperationStatus.CreateSuccessStatus(); }, GetFileByFileIdInt32 = (fileId) => { this.file = new File() { FileId = 1 }; return file; }, UpdateFileFile = (file) => { this.file = file; return true; }, }; this.fileServiceFactory = new StubIFileServiceFactory() { GetFileServiceString = (instanceName) => { return this.fileService; } }; this.repositoryService = new StubIRepositoryService() { GetRepositoryByIdInt32 = (repositoryId) => { return new Repository() { BaseRepository = new BaseRepository() { Name = "SkyDrive", BaseRepositoryId = 2 }, RepositoryId = 1, Name = "test" }; } }; this.queueRepository = new StubIQueueRepository() { DeleteFromQueueBaseMessage = (message) => { this.deletedMessage = message; }, UpdateMessageBaseMessage = (message) => { this.updatedQueueContent = true; } }; this.blobRepository = new StubIBlobDataRepository() { DeleteFileString = (filename) => { this.isDeletedFromBlob = true; return this.isDeletedFromBlob; } }; VerifyFileQueueService queueService = new VerifyFileQueueService(this.fileServiceFactory, this.repositoryService, this.queueRepository, this.blobRepository); return queueService; }