private static void Main() { var viewPath = $"{BasePath}/Views/Inheritance.cs.docx"; var documentPath = $"{BasePath}/Documents/Inheritance.docx"; #if DEBUG string documentViewer = null; // NET35 and NET45 will automatically search for a Docx viewer. //var documentViewer = @"C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE"; // NETCOREAPP3_1 and NET6_0 won't. Ide.Start(viewPath, documentPath, null, typeof(MyDocument), f => ((MyDocument)f).MyProperty = "The code", documentViewer); #else var myDocument = DocumentFactory.Create <MyDocument>(viewPath); myDocument.MyProperty = "The Code"; // It's possible to generate a file or a stream. // 1. Generate a file // myDocument.Generate(documentPath); //2. Generate an output stream. using (var outputStream = myDocument.Generate()) { using (var outputFile = File.Open(documentPath, FileMode.Create)) { outputFile.Write(outputStream.GetBuffer(), 0, (int)outputStream.Length); } } #endif }
public DecryptResponse Decrypt(DecryptRequest request) { if (request == null) { throw new ArgumentNullException("request"); } if (request.DocumentId == null) { throw new ArgumentException("documentId must not be null"); } var cache = ServiceHelper.Cache; using (var document = DocumentFactory.LoadFromCache(cache, request.DocumentId)) { DocumentHelper.CheckLoadFromCache(document); if (!document.Decrypt(request.Password)) { throw new ServiceException("Incorrect Password", HttpStatusCode.Forbidden); } document.SaveToCache(); return(new DecryptResponse { Document = document }); } }
/// <summary> /// Opens a view content for the specified file /// or returns the existing view content for the file if it is already open. /// </summary> /// <param name="fileName">The name of the file to open.</param> /// <param name="switchToOpenedView">Specifies whether to switch to the view for the specified file.</param> /// <returns>The existing or opened <see cref="IViewContent"/> for the specified file.</returns> public IDocument OpenFile(string fileName, bool switchToOpenedDocument) { if (!File.Exists(fileName)) { throw new FileNotFoundException("File not found", fileName); } fileName = FileHelper.NormalizePath(fileName); loggingService.Value.Info("Open file " + fileName); OpenedFile file = GetOpenedFile(fileName); if (file == null) { file = GetOrCreateOpenedFile(fileName); file.TextSelectionChanged += TextSelectionChanged; DocumentFactory.CreateDocumentForFile(file); } if (file.Document != null) { LayoutManager.ShowDocument(file.Document, switchToOpenedDocument); } return(file.Document); }
private static void ExecuteTemplates(out WeakReference loadContextRef) { var loadCtx = new TestAssemblyLoadContext(Path.GetDirectoryName(typeof(Program).Assembly.Location)); DocumentFactory.LoadContext = loadCtx; var viewPath = $"{BasePath}/Views/Tutorial.cs.docx"; var documentPath = $"{BasePath}/Documents/Tutorial.docx"; var imageDirectory = $"{BasePath}/Images"; #if DEBUG Ide.Start(viewPath, documentPath, null, null, f => f.ImageDirectory = imageDirectory); #else DocumentBase document = DocumentFactory.Create(viewPath); document.ImageDirectory = imageDirectory; document.Generate(documentPath); #endif loadContextRef = new WeakReference(loadCtx); Console.WriteLine("---------------------Assemblies Loaded In the Default Context-------------------------------"); var assemblyNames = AssemblyLoadContext.Default.Assemblies.Select(s => s.FullName).ToArray(); Console.WriteLine(string.Join(Environment.NewLine, assemblyNames)); Console.WriteLine("---------------------Assemblies Loaded In Context-------------------------------"); assemblyNames = loadCtx.Assemblies.Select(s => s.FullName).ToArray(); Console.WriteLine(string.Join(Environment.NewLine, assemblyNames)); loadCtx.Unload(); DocumentFactory.LoadContext = null; }
public void Test() { using (var temp = new TempDirectory(System.IO.Directory.GetCurrentDirectory())) using (var directory = FSDirectory.Open(temp.Path)) { var analyzer = new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30); IndexWriter.MaxFieldLength length = new IndexWriter.MaxFieldLength(IndexWriter.DEFAULT_MAX_FIELD_LENGTH); var writer = new IndexWriter(directory, analyzer, length); var documentFactory = new DocumentFactory(); var searchItem1 = new SearchItem { EntityID = 1, Abstract = "abstract1", Keywords = new string[0], Text = "text1" }; var searchItem2 = new SearchItem { EntityID = 2, Abstract = "abstract2", Keywords = new string[0], Text = "text2" }; var searchItem3 = new SearchItem { EntityID = 3, Abstract = "abstract3", Keywords = new string[0], Text = "text3" }; writer.AddDocument(documentFactory.Create(searchItem1)); writer.AddDocument(documentFactory.Create(searchItem2)); writer.AddDocument(documentFactory.Create(searchItem3)); writer.Commit(); writer.NumDocs().Should().Be(3); writer.Dispose(); } }
public virtual void ShouldRenderDocumentToCreateStringVersionOfMessage() { XmlDocument document = new DocumentFactory().CreateFromString("<myMessage></myMessage>"); RequestMessage message = SimpleRequestMessage.Create(document); Assert.IsTrue(message.GetMessageAsString().Contains("<myMessage"), "message"); }
public void KeywordShouldBeAnalyzedField() { var searchItem = new SearchItem { EntityID = 1, Abstract = "--abstract--", Keywords = new[] { "keyword1", "keyword2", "keyword3" }, Text = "--text--", }; var testSubject = new DocumentFactory(); var document = testSubject.Create(searchItem); var abstractField = document.GetField("Keyword"); abstractField.IsBinary.Should().BeFalse(); abstractField.IsIndexed.Should().BeTrue(); abstractField.IsLazy.Should().BeFalse(); abstractField.IsStored.Should().BeFalse(); abstractField.IsStoreOffsetWithTermVector.Should().BeFalse(); abstractField.IsStorePositionWithTermVector.Should().BeFalse(); abstractField.IsTermVectorStored.Should().BeFalse(); abstractField.IsTokenized.Should().BeTrue(); abstractField.OmitNorms.Should().BeFalse(); abstractField.OmitTermFreqAndPositions.Should().BeFalse(); }
public void DocumentShouldHaveCorrectFieldNames() { var searchItem = new SearchItem { EntityID = 1, Abstract = "--abstract--", Keywords = new[] { "keyword1", "keyword2", "keyword3" }, Text = "--text--", }; var testSubject = new DocumentFactory(); var document = testSubject.Create(searchItem); var fields = document.GetFields(); var names = String.Join(",", fields.Select(x => x.Name).ToArray()); //names.Should().Be("donkey"); fields.Any(x => x.Name == "Abstract").Should().BeTrue(); fields.Any(x => x.Name == "Text").Should().BeTrue(); fields.Count(x => x.Name == "Keyword").Should().Be(3); document.Get("Abstract").Should().Be("--abstract--"); document.Get("Text").Should().Be("--text--"); document.GetValues("Keyword").Should().HaveCount(3); document.GetValues("Keyword").Should().Contain("keyword1", "keyword2", "keyword3"); }
/// <exception cref="System.IO.IOException"></exception> /// <exception cref="Platform.Xml.Sax.SAXException"></exception> private MessageValidatorResult ValidateWithActualService(string resourceName) { XmlDocument document = new DocumentFactory().CreateFromResource(new ClasspathResource(this.GetType(), resourceName)); MessageDefinitionService messageDefinitionService = new MessageDefinitionServiceFactory().Create(); return(new MessageValidatorImpl(messageDefinitionService).Validate(document, SpecificationVersion.R02_04_02)); }
public void TestDocumentRemoveStoreTest() { var document = new DocumentFactory().CreateDocument(); var top = "1234567890\n"; var testText = "12345678\n" + "1234567\n" + "123456\n" + "12345\n" + "1234\n" + "123\n" + "12\n" + "1\n" + "\n"; document.TextContent = top + testText; document.Remove(offset: 0, length: top.Length); Assert.AreEqual(document.TextContent, testText); document.Remove(offset: 0, length: document.TextLength); var line = document.GetLineSegment(lineNumber: 0); Assert.AreEqual(expected: 0, actual: line.Offset); Assert.AreEqual(expected: 0, actual: line.Length); Assert.AreEqual(expected: 0, actual: document.TextLength); Assert.AreEqual(expected: 1, actual: document.TotalNumberOfLines); }
protected IDocument DocumentCreator() { var dialog = new NameDialog(); if (dialog.ShowDialog() == DialogResult.OK) { var name = dialog.EnteredText; var projectDir = FProject.Location.GetLocalDir(); var documentPath = projectDir.ConcatPath(name); var document = DocumentFactory.CreateDocumentFromFile(documentPath); if (File.Exists(document.Location.LocalPath)) { document.Load(); } else { document.Save(); } return(document); } else { return(null); } }
public TextEditorControl() { SetStyle(ControlStyles.ContainerControl, true); textAreaPanel.Dock = DockStyle.Fill; Document = new DocumentFactory().CreateDocument(); Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(); primaryTextArea = new TextAreaControl(this); activeTextAreaControl = primaryTextArea; primaryTextArea.TextArea.GotFocus += delegate { SetActiveTextAreaControl(primaryTextArea); }; primaryTextArea.Dock = DockStyle.Fill; textAreaPanel.Controls.Add(primaryTextArea); InitializeTextAreaControl(primaryTextArea); Controls.Add(textAreaPanel); ResizeRedraw = true; Document.UpdateCommited += CommitUpdateRequested; OptionsChanged(); }
// TODO: IHyperMedia zurückgeben public Entity GetById(int key) { var document = new DocumentFactory(); var vokabel = new VokabelnRepository(); return(document.CreateVokabel(Url, vokabel.GetBy(key))); }
public CheckCacheInfoResponse CheckCacheInfo(CheckCacheInfoRequest request) { if (request == null) { throw new ArgumentNullException("request"); } var cache = ServiceHelper.Cache; DocumentCacheInfo cacheInfo = DocumentFactory.GetDocumentCacheInfo(cache, request.Uri.ToString()); if (cacheInfo == null) { return(new CheckCacheInfoResponse()); } var documentMimeType = cacheInfo.MimeType; var status = DocumentFactory.MimeTypes.GetStatus(documentMimeType); var isAccepted = status != DocumentMimeTypeStatus.Denied; var serviceCacheInfo = new CacheInfo { IsVirtual = cacheInfo.IsVirtual, IsLoaded = cacheInfo.IsLoaded, HasAnnotations = cacheInfo.HasAnnotations, Name = cacheInfo.Name, MimeType = documentMimeType, IsMimeTypeAccepted = isAccepted, PageCount = cacheInfo.PageCount }; return(new CheckCacheInfoResponse { CacheInfo = serviceCacheInfo }); }
private List <CodeDocument> GetProjectItemFiles(ProjectItems items) { List <CodeDocument> files = new List <CodeDocument>(); foreach (ProjectItem item in items) { if (item.SubProject != null) { files = files.Union(GetProjectItemFiles(item.ProjectItems)).ToList(); } else if (item.ProjectItems != null && item.ProjectItems.Count > 0) { files = files.Union(GetProjectItemFiles(item.ProjectItems)).ToList(); } else { string fileName = item.Name; string extension = Path.GetExtension(fileName); if (allowedExtensions.Contains(extension) == true) { //AC Note: This will not save an unopened file. Is this desired behavior? if (item.Document != null) { files.Add((CodeDocument)DocumentFactory.FromDteDocument(item.Document)); } } } } return(files); }
public HttpResponseMessage GetDocumentData(string documentId) { var cache = ServiceHelper.Cache; var cacheInfo = DocumentFactory.GetDocumentCacheInfo(cache, documentId); DocumentHelper.CheckCacheInfo(cacheInfo); string contentType = cacheInfo.MimeType; var response = new HttpResponseMessage(HttpStatusCode.OK); // Required headers for client-side PDF streaming response.Headers.Remove("Accept-Ranges"); response.Headers.Remove("Access-Control-Expose-Headers"); response.Headers.Add("Access-Control-Expose-Headers", "Accept-Ranges, Content-Encoding, Content-Length"); Action <Stream, HttpContent, TransportContext> write = (stream, content, context) => { DocumentFactory.DownloadDocument(cache, documentId, 0, -1, stream); stream.Close(); }; response.Content = new PushStreamContent(write, new MediaTypeHeaderValue(contentType)); return(response); }
private void _openFromCacheToolStripMenuItem_Click(object sender, EventArgs e) { if (_cache == null) { UI.Helper.ShowInformation(this, "This feature is only available when a Document Cache is used"); return; } using (var dlg = new UI.InputDialog()) { dlg.Text = "Document ID"; dlg.ValueTitle = "Enter the ID of a document previously saved into the cache"; // If the document is already in the cache, show its ID for easy re-loading LEADDocument document = _documentViewer.Document; if (document != null && DocumentFactory.GetDocumentCacheInfo(_cache, document.DocumentId) != null) { dlg.ValueDescription1 = "The current document ID is:"; dlg.Value = document.DocumentId; } else { dlg.Value = string.Empty; } dlg.AllowEmptyValue = false; if (dlg.ShowDialog(this) == DialogResult.OK) { LoadDocumentFromCache(dlg.Value); } } }
public virtual void TestFormatEmptyAddress() { AdBasicPropertyFormatter formatter = new AdBasicPropertyFormatter(); string result = formatter.Format(GetContext("address", "AD.BASIC"), new ADImpl(this.address)); Assert.IsTrue(this.result.IsValid()); string expectedResult = "<address>" + SystemUtils.LINE_SEPARATOR + "</address>" + SystemUtils.LINE_SEPARATOR; AssertXmlEquals("empty address", expectedResult, result); // a funny case: make sure adding a null address use is like not adding one at all // (i.e., just like above) this.address.AddUse(null); AssertXmlEquals("empty address - even with \"null\" address use", expectedResult, result); this.address.AddUse(Ca.Infoway.Messagebuilder.Domainvalue.Basic.X_BasicPostalAddressUse.WORK_PLACE); result = formatter.Format(GetContext("address", "AD.BASIC"), new ADImpl(this.address)); Assert.IsFalse(this.result.IsValid()); Assert.AreEqual(1, this.result.GetHl7Errors().Count); // null not allowed for use expectedResult = "<address use=\"WP\">" + SystemUtils.LINE_SEPARATOR + "</address>" + SystemUtils.LINE_SEPARATOR; AssertXmlEquals("empty workplace address", expectedResult, result); this.result.ClearErrors(); this.address.AddUse(Ca.Infoway.Messagebuilder.Domainvalue.Basic.X_BasicPostalAddressUse.HOME); result = formatter.Format(GetContext("address", "AD.BASIC"), new ADImpl(this.address)); Assert.IsFalse(this.result.IsValid()); Assert.AreEqual(1, this.result.GetHl7Errors().Count); // null not allowed for use XmlDocument document = new DocumentFactory().CreateFromString(result); string attribute = (document.DocumentElement).GetAttribute("use"); FormatterAssert.AssertContainsSame("uses", FormatterAssert.ToSet("H WP"), FormatterAssert.ToSet(attribute)); }
public void ProhibitsRetrievalOfArrayWithinMemberChain() { var source = @" class Test { private static readonly C c = new C(); public void Run() { var v = Test.c.Value.Value.Values; } } class A { public readonly int[] Values; } class B { public readonly A Value; } class C { public readonly B Value; }"; var semanticModel = DocumentFactory.Create().CreateSemanticModel(source); var method = semanticModel.SyntaxTree.GetRoot().DescendantNodes() .OfType <MethodDeclarationSyntax>() .Single(); CodeFactory.Create(method.Body, semanticModel); }
public void TestDocumentRemoveStoreTest() { IDocument document = new DocumentFactory().CreateDocument(); string top = "1234567890\n"; string testText = "12345678\n" + "1234567\n" + "123456\n" + "12345\n" + "1234\n" + "123\n" + "12\n" + "1\n" + "\n"; document.TextContent = top + testText; document.Remove(0, top.Length); Assert.AreEqual(document.TextContent, testText); document.Remove(0, document.TextLength); LineSegment line = document.GetLineSegment(0); Assert.AreEqual(0, line.Offset); Assert.AreEqual(0, line.Length); Assert.AreEqual(0, document.TextLength); Assert.AreEqual(1, document.TotalNumberOfLines); }
public virtual void SetUp() { MockMessageBeanRegistry.Initialize(); CodeResolverRegistry.Register(new TrivialCodeResolver()); this.transformer = new MessageBeanTransformerImpl(new MockTestCaseMessageDefinitionService(), RenderMode.PERMISSIVE); this.factory = new DocumentFactory(); }
public void AllowsLongChainOfReadOnlyFields() { var source = @" class Test { private static readonly C c = new C(); public void Run() { var v = Test.c.Value.Value.Value; } } class A { public readonly int Value; } class B { public readonly A Value; } class C { public readonly B Value; }"; var semanticModel = DocumentFactory.Create().CreateSemanticModel(source); var method = semanticModel.SyntaxTree.GetRoot().DescendantNodes() .OfType <MethodDeclarationSyntax>() .Single(); var code = CodeFactory.Create(method.Body, semanticModel); var expected = @" DECL v v = \literal"; Assert.AreEqual(expected.Trim(), CodeStringifier.Generate(code)); }
private static void Main() { var viewPath = $"{BasePath}/Views/Inheritance.cs.docx"; var documentPath = $"{BasePath}/Documents/Inheritance.docx"; #if DEBUG Ide.Start(viewPath, documentPath, null, typeof(MyDocument), f => ((MyDocument)f).MyProperty = "The code"); #else var myDocument = DocumentFactory.Create <MyDocument>(viewPath); myDocument.MyProperty = "The Code"; // It's possible to generate a file or a stream. // 1. Generate a file // myDocument.Generate(documentPath); //2. Generate an output stream. using (var outputStream = myDocument.Generate()) { using (var outputFile = File.Open(documentPath, FileMode.Create)) { outputFile.Write(outputStream.GetBuffer(), 0, (int)outputStream.Length); } } #endif }
public override Task <IMarkpadDocument> Publish() { var save = new ButtonExtras(ButtonType.Yes, "Save", "Saves this modified post to your blog"); var saveAs = new ButtonExtras(ButtonType.No, "Save As", "Saves this blog post as a local markdown file"); var publish = new ButtonExtras(ButtonType.Retry, "Publish As", "Publishes this post to another blog, or as another post"); var service = new DialogMessageService(null) { Icon = DialogMessageIcon.Question, Buttons = DialogMessageButtons.Yes | DialogMessageButtons.No | DialogMessageButtons.Retry | DialogMessageButtons.Cancel, Title = "Markpad", Text = string.Format("{0} has already been published, what do you want to do?", Title), ButtonExtras = new[] { save, saveAs, publish } }; var result = service.Show(); switch (result) { case DialogMessageResult.Yes: return(Save()); case DialogMessageResult.No: return(SaveAs()); case DialogMessageResult.Retry: return(DocumentFactory.PublishDocument(null, this)); } return(TaskEx.FromResult <IMarkpadDocument>(this)); }
public void SetUp() { IDocument doc = new DocumentFactory().CreateDocument(); StringBuilder b = new StringBuilder(); for (int i = 0; i < 50; i++) { b.AppendLine(new string('a', 50)); } doc.TextContent = b.ToString(); list = new List <FoldMarker>(); list.Add(new FoldMarker(doc, 1, 6, 5, 2)); list.Add(new FoldMarker(doc, 2, 1, 2, 3)); list.Add(new FoldMarker(doc, 3, 7, 4, 1)); list.Add(new FoldMarker(doc, 10, 1, 14, 1)); list.Add(new FoldMarker(doc, 10, 3, 10, 3)); list.Add(new FoldMarker(doc, 11, 1, 15, 1)); list.Add(new FoldMarker(doc, 12, 1, 16, 1)); foreach (FoldMarker fm in list) { fm.IsFolded = true; } doc.FoldingManager.UpdateFoldings(new List <FoldMarker>(list)); manager = doc.FoldingManager; }
public void SetUpFixture() { string python = "class Test:\r\n" + "\tdef __init__(self):\r\n" + "\t\tpass\r\n"; DefaultProjectContent projectContent = new DefaultProjectContent(); PythonParser parser = new PythonParser(); compilationUnit = parser.Parse(projectContent, @"C:\test.py", python); if (compilationUnit.Classes.Count > 0) { c = compilationUnit.Classes[0]; if (c.Methods.Count > 0) { method = c.Methods[0]; } // Get folds. ParserFoldingStrategy foldingStrategy = new ParserFoldingStrategy(); ParseInformation parseInfo = new ParseInformation(); parseInfo.SetCompilationUnit(compilationUnit); DocumentFactory docFactory = new DocumentFactory(); IDocument doc = docFactory.CreateDocument(); doc.TextContent = python; List <FoldMarker> markers = foldingStrategy.GenerateFoldMarkers(doc, @"C:\Temp\test.py", parseInfo); if (markers.Count > 1) { classMarker = markers[0]; methodMarker = markers[1]; } } }
public void CloneResultsInClonedDocument() { // Given MetadataDictionary initialMetadata = new MetadataDictionary(); initialMetadata.Add("Foo", "Bar"); DocumentFactory documentFactory = new DocumentFactory(initialMetadata); CustomDocumentFactory <TestDocument> customDocumentFactory = new CustomDocumentFactory <TestDocument>(documentFactory); TestExecutionContext context = new TestExecutionContext(); CustomDocument sourceDocument = (CustomDocument)customDocumentFactory.GetDocument(context); // When IDocument resultDocument = customDocumentFactory.GetDocument( context, sourceDocument, new Dictionary <string, object> { { "Baz", "Bat" } }); // Then CollectionAssert.AreEquivalent( new Dictionary <string, object> { { "Foo", "Bar" } }, sourceDocument); CollectionAssert.AreEquivalent( new Dictionary <string, object> { { "Foo", "Bar" }, { "Baz", "Bat" } }, resultDocument); }
/// <summary> /// Creates an engine with the specified application state, configuration, and service provider. /// </summary> /// <param name="applicationState">The state of the application (or <c>null</c> for an empty application state).</param> /// <param name="serviceCollection">The service collection (or <c>null</c> for an empty default service collection).</param> /// <param name="configuration">The application configuration.</param> /// <param name="settings">Settings that should override configuration values.</param> /// <param name="classCatalog">A class catalog of all assemblies in scope.</param> public Engine( ApplicationState applicationState, IServiceCollection serviceCollection, IConfiguration configuration, IEnumerable <KeyValuePair <string, object> > settings, ClassCatalog classCatalog) { _pipelines = new PipelineCollection(this); ApplicationState = applicationState ?? new ApplicationState(null, null, null); ClassCatalog = classCatalog ?? new ClassCatalog(); ClassCatalog.Populate(); ScriptHelper = new ScriptHelper(this); Settings = new ConfigurationSettings( this, configuration ?? new ConfigurationRoot(Array.Empty <IConfigurationProvider>()), settings); _serviceScope = GetServiceScope(serviceCollection); _logger = Services.GetRequiredService <ILogger <Engine> >(); DocumentFactory = new DocumentFactory(this, Settings); _diagnosticsTraceListener = new DiagnosticsTraceListener(_logger); System.Diagnostics.Trace.Listeners.Add(_diagnosticsTraceListener); // Add the service-based pipelines as late as possible so other services have been configured AddServicePipelines(); }
public void EqualityOperatorOverloadedCustomType() { var code = @" class Test { public void Run() { if(new Integer() == new Integer()) {} } } class Integer { public static bool operator ==(Integer lhv, Integer b) { return false; } public static bool operator !=(Integer lhv, Integer b) { return false; } }"; var semanticModel = DocumentFactory.Create().CreateSemanticModel(code); var binary = semanticModel.SyntaxTree.GetRoot().DescendantNodes() .OfType <BinaryExpressionSyntax>() .Single(); Assert.IsTrue(binary.IsOverloadedBinaryOperator(semanticModel)); }
public void CreateIndexer() { TestUtils.InitializeDefaultExtensionPoints(); _indexerPath = Path.GetTempPath() + "luceneindexer"; Directory.CreateDirectory(_indexerPath); _solutionKey = new SolutionKey(Guid.NewGuid(), "C:/SolutionPath"); ServiceLocator.RegisterInstance(_solutionKey); ServiceLocator.RegisterInstance <Analyzer>(new SimpleAnalyzer()); _indexer = new DocumentIndexer(TimeSpan.FromSeconds(1)); ServiceLocator.RegisterInstance(_indexer); ClassElement classElement = SampleProgramElementFactory.GetSampleClassElement( accessLevel: AccessLevel.Public, definitionLineNumber: 11, extendedClasses: "SimpleClassBase", fullFilePath: "C:/Projects/SimpleClass.cs", implementedInterfaces: "IDisposable", name: "SimpleName", namespaceName: "Sanod.Indexer.UnitTests" ); SandoDocument sandoDocument = DocumentFactory.Create(classElement); _indexer.AddDocument(sandoDocument); MethodElement methodElement = SampleProgramElementFactory.GetSampleMethodElement( accessLevel: AccessLevel.Protected, name: "SimpleName", returnType: "Void", fullFilePath: "C:/stuff" ); sandoDocument = DocumentFactory.Create(methodElement); _indexer.AddDocument(sandoDocument); }
public async Task LoadCustomDocumentWithoutUnregisteredHandler() { var type = "text/markdown"; var documentFactory = new DocumentFactory(); documentFactory.Register(type, (ctx, options, cancel) => Task.FromResult<IDocument>(new MarkdownDocument(ctx, options.Source))); var handler = documentFactory.Unregister(type); var config = new Configuration(new Object[] { documentFactory, new ContextFactory(), new ServiceFactory(), new HtmlElementFactory(), new SvgElementFactory(), new MathElementFactory(), new EventFactory() }); var context = BrowsingContext.New(config); var document = await context.OpenAsync(res => res.Content("").Header(HeaderNames.ContentType, type)); Assert.IsNotNull(handler); Assert.IsInstanceOf<HtmlDocument>(document); }
public web_session(DocumentFactory factory) : base(factory) { }
public NewWordDocument(DocumentFactory factory) { _factory = factory; }
public async Task LoadCustomDocumentWithRegisteredHandler() { var documentFactory = new DocumentFactory(); documentFactory.Register("text/markdown", (ctx, options, cancel) => Task.FromResult<IDocument>(new MarkdownDocument(ctx, options.Source))); var config = new Configuration(new Object[] { documentFactory, new ContextFactory(), new ServiceFactory() }); var context = BrowsingContext.New(config); var document = await context.OpenAsync(res => res.Content("").Header(HeaderNames.ContentType, "text/markdown")); Assert.IsInstanceOf<MarkdownDocument>(document); }
VoteReportContentGenerator( Transformer transformer, ISerializer serializer, DocumentFactory factory ) { this.transformer = transformer; this.serializer = serializer; this.factory = factory; }