public IActionResult Post(NewItemRequest dto) { _logger.LogInformation("New request"); _backgroundJobs.Enqueue(() => _processDocument.Process(dto)); return(Ok()); }
public void ProcessDocumentTestXMLReturnsTypeOfNode() { Console.WriteLine("ProcessDocumentTestXMLReturnsTypeOfNode"); string xml = "<?xml version=\"1.0\"?><doc></doc>"; string type = "XML"; ProcessDocument pro = ProcessDocument.GetProcess(xml, type); Assert.AreEqual(typeof(Node), pro.Process().GetType()); }
public IActionResult Post(NewFileToProcess dto) { if (!ModelState.IsValid) { return(BadRequest("Missing parameters")); } _backgroundJobs.Enqueue(() => _processDocument.Process(dto)); return(Ok()); }
public void OutputTest() { Console.WriteLine("OutputTest"); string xml = "<?xml version=\"1.0\"?><doc></doc>"; string type = "XML"; ProcessDocument process = ProcessDocument.GetProcess(xml, type); Node n = process.Process(); Output output = new Output(n); Assert.IsNotNull(output); Assert.AreEqual(typeof(Output), output.GetType()); }
public void CreateGridTest() { Console.WriteLine("CreateGridTest"); JObject expected = JObject.Parse("{\"text\":\"doc\",\"id\":1,\"state\":{\"selected\":true}}"); string xml = "<?xml version=\"1.0\"?><doc></doc>"; string type = "XML"; ProcessDocument process = ProcessDocument.GetProcess(xml, type); Node n = process.Process(); Output output = new Output(n); Assert.AreEqual(expected, output.CreateGrid()); }
public void Must_process_all_pages_from_document() { const string filePath = "file.pdf"; const int numberOfPages = 2; const string pageText1 = "Text 1"; const string pageText2 = "Text 2"; A.CallTo(() => _fileManager.Download(_newFileToProcess.Url)).Returns(filePath); A.CallTo(() => _fileManager.GetNumberOfPages(filePath)).Returns(numberOfPages); A.CallTo(() => _extractionManager.Extract(filePath, 1)).Returns(pageText1); A.CallTo(() => _extractionManager.Extract(filePath, 2)).Returns(pageText2); _processDocument.Process(_newFileToProcess).Wait(); A.CallTo(() => _callback.Send( A <DocumentResultResponse> .That.Matches(d => d.Pages.Count == numberOfPages), _newFileToProcess.CallbackUrl)); A.CallTo(() => _callback.Send( A <DocumentResultResponse> .That.Matches(d => d.Pages[0].Text == pageText1), _newFileToProcess.CallbackUrl)); A.CallTo(() => _callback.Send( A <DocumentResultResponse> .That.Matches(d => d.Pages[1].Text == pageText2), _newFileToProcess.CallbackUrl)); }
public void CreateViewTest() { Console.WriteLine("CreateViewTest"); string expected = "<div class='text-center ui-layout-center ui-layout-pane ui-layout-pane-center'><div style ='display:inline-block' class='ui-selectable ui-droppable'><div id='1'class='node type ui-draggable ui-selectee' style='left:100px; top:130px;'><div class='head'><span><button class='nameBtn' onclick='GetNode(1)'>doc</button></span></div></div></div></div></div>"; string xml = "<?xml version=\"1.0\"?><doc></doc>"; string type = "XML"; ProcessDocument process = ProcessDocument.GetProcess(xml, type); Node n = process.Process(); Output output = new Output(n); Console.WriteLine(expected); Console.WriteLine(output.CreateView()); Assert.AreEqual(expected, output.CreateView()); }
public void TestingSingleThreadAndMultiThreadSimularity(string json) { Console.WriteLine("TestingSingleThreadAndMultiThreadSimularity"); string type = "JSON"; ProcessDocument process = ProcessDocument.GetProcess(json, type); Console.WriteLine(process); Node n = process.Process(); process = ProcessDocument.GetProcess(json, type); Node n2 = process.ProcessParallel(); Console.WriteLine(process); Assert.AreEqual(n2.Value, n.Value); Assert.AreEqual(n2.Name, n.Name); Assert.AreEqual(n2.Children.Count, n.Children.Count); Assert.AreEqual(n2.Visited, n.Visited); }