//readonly SendNotificationCommandHGandler sendNotificationCommand; public DocumentController( CreateDocumentCommandHandler createCommandHandler, SearchDocumentsQuery searchDocumentsQuery, SearchCountQuery searchCountQuery, DownloadFileQuery downloadFileQuery, GetOneDocumentQuery getOneQuery, GetAllDocumentTypesQuery getDTsQuery, GetAllEntitiesQuery getEsQuery, GetAllDocumentTypesByUserQuery getDTByUserQuery, DocumentsWithoutFilePagedQuery withoutFileQuery, UpdateFileToDocumentCommandHandler updateFileCommandHandler, DeleteDocumentCommandHandler deleteDocumentCommand, SendDocumentNotificationCommandHandler sendDocmentNotificationCommandHandler //SendNotificationCommandHGandler sendNotificationCommand) { ) { _createCommandHandler = createCommandHandler; this.searchDocumentsQuery = searchDocumentsQuery; this.searchCountQuery = searchCountQuery; this.downloadFileQuery = downloadFileQuery; this.getOneQuery = getOneQuery; this.getDTsQuery = getDTsQuery; this.getEsQuery = getEsQuery; this.withoutFileQuery = withoutFileQuery; this.updateFileCommandHandler = updateFileCommandHandler; this.deleteDocumentCommand = deleteDocumentCommand; this.sendDocumentNotificationCommandHandler = sendDocmentNotificationCommandHandler; this.getDTByUserQuery = getDTByUserQuery; //this.sendNotificationCommand = sendNotificationCommand; }
public async Task Handler_GivenNonExistentFilenameParameters_ReturnsEmptyValue() { var filename = "doesntexist.pdf"; var cancellationToken = new CancellationToken(); var repository = new Mock <IDocumentRepository>(); repository.Setup(x => x.Delete(filename, cancellationToken)).ReturnsAsync(false); var request = new DeleteDocumentCommand(filename); var handler = new DeleteDocumentCommandHandler(repository.Object); var result = await handler.Handle(request, cancellationToken); result.IsSuccessful.ShouldBeFalse(); }
public async Task Handler_GivenValidParameters_ReturnsTrue() { var filename = "example.pdf"; var cancellationToken = new CancellationToken(); var repository = new Mock <IDocumentRepository>(); repository.Setup(x => x.Delete(filename, cancellationToken)).ReturnsAsync(true); var request = new DeleteDocumentCommand(filename); var handler = new DeleteDocumentCommandHandler(repository.Object); var result = await handler.Handle(request, cancellationToken); result.IsSuccessful.ShouldBeTrue(); }
public void Setup() { fileRepository = new Mock <IFileRepository>(); domainRepository = new Mock <IDomainRepository>(); handler = new DeleteDocumentCommandHandler(fileRepository.Object, domainRepository.Object); }