public ExtractPagesTests() { this.persistence = Substitute.For <ISourcesPersistence>(); this.sourceRepository = Substitute.For <ISourcesRepository>(); this.context = Substitute.For <ISourceContext>(); this.imageService = new FakeImageService(); var matcher = Substitute.For <IUriTemplateMatcher>(); this.httpMessageHandler = new MockHttpMessageHandler(); matcher.Match <Brochure>(Arg.Any <Uri>()) .Returns(new UriTemplateMatches(new Dictionary <string, object> { { "id", 10 }, })); this.sourceRepository.GetBrochure(Arg.Any <Uri>()) .Returns(Task.FromResult(new Brochure { Id = new Uri(SourceId), })); this.functions = new ExtractPages( this.sourceRepository, this.imageService, matcher, this.context, this.persistence); this.functions.Client = this.httpMessageHandler.ToHttpClient(); }
public GoogleDriveImport( IDriveServiceFacade drive, ISourceContext context, ISourcesPersistence persistence, IPdfService pdfService) { this.drive = drive; this.context = context; this.persistence = persistence; this.pdfService = pdfService; }
public GoogleDriveImportTests() { this.context = Substitute.For <ISourceContext>(); this.drive = Substitute.For <IDriveServiceFacade>(); this.pdfService = Substitute.For <IPdfService>(); this.persistence = Substitute.For <ISourcesPersistence>(); this.sut = new GoogleDriveImport( this.drive, this.context, this.persistence, this.pdfService); }
public ExtractPages( ISourcesRepository sources, ISourceImageService imageService, IUriTemplateMatcher matcher, ISourceContext sourcesContext, ISourcesPersistence persistence) { this.sources = sources; this.imageService = imageService; this.matcher = matcher; this.sourcesContext = sourcesContext; this.persistence = persistence; this.Client = new HttpClient(); }
public SourcesUpdateModule( ISourcesPersistence persistence, ISourcesRepository repository, IModelTemplateProvider modelTemplateProvider, IUriTemplateExpander expander, IPdfService pdfService) : base(modelTemplateProvider) { this.RequiresAnyPermissions(Permissions.WriteSources, Permissions.AdminSources); this.expander = expander; this.pdfService = pdfService; this.Put <Brochure>(async r => await this.PutSingle(brochure => persistence.SaveBrochure(brochure), repository.GetBrochure)); this.Post <SourceContent>( async r => await this.UploadPdf((int)r.id, repository.GetBrochure, brochure => persistence.SaveBrochure(brochure, true))); this.Delete <SourceContent>( async r => await this.DeletePdf((int)r.id, repository.GetBrochure, brochure => persistence.SaveBrochure(brochure, true))); using (this.Templates) { this.Post <Collection <Brochure> >(async r => await this.CreateBrochure(persistence.CreateBrochure, repository.GetBrochure)); } }