public void StatementProcessor_ProcessEvent_ReturnsCanYouVerifyCurrentEmploymentWhenGivenFilesWereProcessed() { // arrange var target = new StatementProcessor(); // act var result = target.ProcessEvent(new FilesWereProcessed()); // assert Assert.IsTrue(result.SentenceId == Sentences.CanYouVerifyCurrentEmployment); }
public async Task <ConversationDto> Post([FromBody] CreateConversationDto createConversationDto) { await Task.Delay(1); var processor = new StatementProcessor(); var sentence = processor.ProcessEvent((Events)createConversationDto.BusinessEventId); var conversation = new Conversation(createConversationDto.Name, createConversationDto.Language); return(conversation.GetConversationDto(sentence)); }
public void StatementProcessor_ProcessEvent_ReturnsReadyToGetStartedWhenGivenLoanInterviewStarted() { // arrange var target = new StatementProcessor(); // act var result = target.ProcessEvent(new LoanInterviewStarted()); // assert Assert.IsTrue(result.SentenceId == Sentences.ReadyToGetStarted); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldProcessDiscardAllMessage() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldProcessDiscardAllMessage() { StatementProcessor statementProcessor = mock(typeof(StatementProcessor)); _connectionState.StatementProcessor = statementProcessor; BoltStateMachineState nextState = _state.process(DiscardAllMessage.INSTANCE, _context); assertEquals(_readyState, nextState); verify(statementProcessor).streamResult(any()); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: //ORIGINAL LINE: public boolean matches(final Object item) public override bool matches(object item) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.bolt.v1.runtime.BoltStateMachineV1 machine = (org.neo4j.bolt.v1.runtime.BoltStateMachineV1) item; BoltStateMachineV1 machine = ( BoltStateMachineV1 )item; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.bolt.runtime.StatementProcessor statementProcessor = machine.statementProcessor(); StatementProcessor statementProcessor = machine.StatementProcessor(); return(statementProcessor == null || !statementProcessor.HasTransaction()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldHandleErrorWhenProcessingDiscardAllMessage() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldHandleErrorWhenProcessingDiscardAllMessage() { Exception error = new Exception("Hello"); StatementProcessor statementProcessor = mock(typeof(StatementProcessor)); doThrow(error).when(statementProcessor).streamResult(any()); _connectionState.StatementProcessor = statementProcessor; BoltStateMachineState nextState = _state.process(DiscardAllMessage.INSTANCE, _context); assertEquals(_failedState, nextState); verify(_context).handleFailure(error, false); }
private void ProcessFileSelection(OpenFileDialog openFileDialog) { ShowProgressBar(true); List <Task> Tasks = new List <Task>(); foreach (var filePath in openFileDialog.FileNames) { ExcelProcessor ep = new ExcelProcessor(); StatementProcessor sp = new StatementProcessor(); Progress.Add(ep.Progress); Progress.Add(sp.Progress); Task t = Task.Run(() => { try { var data = ep.GetData(filePath); var statementData = sp.Process(data); Parallel.ForEach(statementData, item => { StatementModel.RawData.Add(item); }); } catch (Exception ex) { Dispatcher.Invoke(() => { MessageBox.Show(ex.ToString()); }); } }); Tasks.Add(t); } Task.WhenAll(Tasks) .ContinueWith(x => { BindData(); ShowProgressBar(false); }); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static org.neo4j.bolt.runtime.StatementMetadata processRunMessage(org.neo4j.bolt.v1.messaging.request.RunMessage message, org.neo4j.bolt.runtime.StatementProcessor statementProcessor) throws Exception private static StatementMetadata ProcessRunMessage(RunMessage message, StatementProcessor statementProcessor) { if (isBegin(message)) { Bookmark bookmark = Bookmark.fromParamsOrNull(message.Params()); statementProcessor.BeginTransaction(bookmark); return(StatementMetadata.EMPTY); } else if (isCommit(message)) { statementProcessor.CommitTransaction(); return(StatementMetadata.EMPTY); } else if (isRollback(message)) { statementProcessor.RollbackTransaction(); return(StatementMetadata.EMPTY); } else { return(statementProcessor.Run(message.Statement(), message.Params())); } }
public void SetStatementPath(string path) { _statementProcessor = new StatementProcessor(path); }
public StatementProcessingService(string path) { _statementProcessor = new StatementProcessor(path); }
//Function with same name as the event is called when the event is dispatched by the Dialogue Tree void OnSubtitlesRequest(SubtitlesRequestInfo info) { enabled = true; currentActor = info.actor; StatementProcessor.ProcessStatement(info.statement, info.actor, info.Continue); }
internal new static SObject Parse(ScriptProcessor processor, string code) { code = code.Trim(); if (Regex.IsMatch(code, REGEX_CLASS_SIGNATURE, RegexOptions.Singleline)) { var signature = code.Remove(code.IndexOf("{")).Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList(); var extends = ""; var identifier = ""; var isAbstract = false; // Read extends: if (signature.Contains(CLASS_SIGNATURE_EXTENDS)) { var extendsIndex = signature.IndexOf(CLASS_SIGNATURE_EXTENDS); if (extendsIndex + 1 == signature.Count) // when extends is the last element in the signature, throw error: { processor.ErrorHandler.ThrowError(ErrorType.SyntaxError, ErrorHandler.MESSAGE_SYNTAX_CLASS_EXTENDS_MISSING); } extends = signature[extendsIndex + 1]; // The extended class name is after the "extends" keyword. signature.RemoveAt(extendsIndex); // Remove at the extends index twice, to remove the "extends" keyword and the identifier of the extended class. signature.RemoveAt(extendsIndex); } // Read abstract: if (signature.Contains(CLASS_SIGNATURE_ABSTRACT)) { isAbstract = true; signature.Remove(CLASS_SIGNATURE_ABSTRACT); } if (signature.Count != 2) // The signature must only have "class" and the identifier left. { processor.ErrorHandler.ThrowError(ErrorType.SyntaxError, ErrorHandler.MESSAGE_SYNTAX_INVALID_CLASS_SIGNATURE); } // Read class name: identifier = signature[1]; if (!ScriptProcessor.IsValidIdentifier(identifier)) { processor.ErrorHandler.ThrowError(ErrorType.SyntaxError, ErrorHandler.MESSAGE_SYNTAX_CLASS_IDENTIFIER_MISSING); } // Create instance: var prototype = new Prototype(identifier) { IsAbstract = isAbstract }; // Handle extends: if (extends.Length > 0) { if (isAbstract) { processor.ErrorHandler.ThrowError(ErrorType.SyntaxError, ErrorHandler.MESSAGE_TYPE_ABSTRACT_NO_EXTENDS); } var extendedPrototype = processor.Context.GetPrototype(extends); if (extendedPrototype == null) { processor.ErrorHandler.ThrowError(ErrorType.ReferenceError, ErrorHandler.MESSAGE_REFERENCE_NO_PROTOTYPE, extends); } prototype.Extends = extendedPrototype; } else { // Set default prototype: prototype.Extends = processor.Context.GetPrototype("Object"); } var body = code.Remove(0, code.IndexOf("{") + 1); body = body.Remove(body.Length - 1, 1).Trim(); var additionalCtorCode = ""; var staticCtorCode = ""; var statements = StatementProcessor.GetStatements(processor, body); for (var i = 0; i < statements.Length; i++) { var statement = statements[i]; if (statement.StatementType == StatementType.Var) { var parsed = ParseVarStatement(processor, statement); if (parsed.Item1.Identifier == CLASS_METHOD_CTOR) { processor.ErrorHandler.ThrowError(ErrorType.SyntaxError, ErrorHandler.MESSAGE_SYNTAX_MISSING_VAR_NAME); } prototype.AddMember(processor, parsed.Item1); if (parsed.Item2.Length > 0) { if (parsed.Item1.IsStatic) { staticCtorCode += string.Format(FORMAT_VAR_ASSIGNMENT, parsed.Item1.Identifier, parsed.Item2); } else { additionalCtorCode += string.Format(FORMAT_VAR_ASSIGNMENT, parsed.Item1.Identifier, parsed.Item2); } } } else if (statement.StatementType == StatementType.Function) { i++; if (statements.Length > i) { var bodyStatement = statements[i]; var parsed = ParseFunctionStatement(processor, statement, bodyStatement); if (parsed.Identifier == CLASS_METHOD_CTOR) { if (prototype.Constructor != null) { processor.ErrorHandler.ThrowError(ErrorType.SyntaxError, ErrorHandler.MESSAGE_SYNTAX_CLASS_DUPLICATE_DEFINITION, parsed.Identifier, identifier); } prototype.Constructor = parsed; } else { prototype.AddMember(processor, parsed); } } else { return(processor.ErrorHandler.ThrowError(ErrorType.SyntaxError, ErrorHandler.MESSAGE_SYNTAX_EXPECTED_EXPRESSION, "end of script")); } } else { processor.ErrorHandler.ThrowError(ErrorType.SyntaxError, ErrorHandler.MESSAGE_SYNTAX_CLASS_INVALID_STATEMENT); } } // Add additional constructor code & static constructor code to prototype: if (staticCtorCode.Length > 0) { prototype._staticConstructor = new SFunction(staticCtorCode, new string[] { }); prototype._staticConstructorProcessor = processor; } if (additionalCtorCode.Length > 0) { if (prototype.Constructor == null) { // Create new ctor if no one has been defined: prototype.Constructor = new PrototypeMember(CLASS_METHOD_CTOR, new SFunction("", new string[] { }), false, true, false, false); } prototype.Constructor.ToFunction().Body = additionalCtorCode + prototype.Constructor.ToFunction().Body; } return(prototype); } else { return(processor.ErrorHandler.ThrowError(ErrorType.SyntaxError, ErrorHandler.MESSAGE_SYNTAX_INVALID_CLASS_SIGNATURE)); } }
internal new static SObject Parse(ScriptProcessor processor, string code) { code = code.Trim(); if (Regex.IsMatch(code, RegexClassSignature, RegexOptions.Singleline)) { var signature = code.Remove(code.IndexOf("{", StringComparison.Ordinal)).Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList(); var extends = ""; var isAbstract = false; // Read extends: if (signature.Contains(ClassSignatureExtends)) { var extendsIndex = signature.IndexOf(ClassSignatureExtends); if (extendsIndex + 1 == signature.Count) // when extends is the last element in the signature, throw error: { processor.ErrorHandler.ThrowError(ErrorType.SyntaxError, ErrorHandler.MessageSyntaxClassExtendsMissing); } extends = signature[extendsIndex + 1]; // The extended class name is after the "extends" keyword. signature.RemoveAt(extendsIndex); // Remove at the extends index twice, to remove the "extends" keyword and the identifier of the extended class. signature.RemoveAt(extendsIndex); } // Read abstract: if (signature.Contains(ClassSignatureAbstract)) { isAbstract = true; signature.Remove(ClassSignatureAbstract); } if (signature.Count != 2) // The signature must only have "class" and the identifier left. { processor.ErrorHandler.ThrowError(ErrorType.SyntaxError, ErrorHandler.MessageSyntaxInvalidClassSignature); } // Read class name: var identifier = signature[1]; if (!ScriptProcessor.IsValidIdentifier(identifier)) { processor.ErrorHandler.ThrowError(ErrorType.SyntaxError, ErrorHandler.MessageSyntaxClassIdentifierMissing); } // Create instance: var prototype = new Prototype(identifier) { IsAbstract = isAbstract }; // Handle extends: if (extends.Length > 0) { if (isAbstract) { processor.ErrorHandler.ThrowError(ErrorType.SyntaxError, ErrorHandler.MessageTypeAbstractNoExtends); } var extendedPrototype = processor.Context.GetPrototype(extends); if (extendedPrototype == null) { processor.ErrorHandler.ThrowError(ErrorType.ReferenceError, ErrorHandler.MessageReferenceNoPrototype, extends); } prototype.Extends = extendedPrototype; } else { // Set default prototype: prototype.Extends = processor.Context.GetPrototype("Object"); } var body = code.Remove(0, code.IndexOf("{", StringComparison.Ordinal) + 1); body = body.Remove(body.Length - 1, 1).Trim(); var additionalCtorCode = ""; var staticCtorCode = ""; var statements = StatementProcessor.GetStatements(processor, body); for (var i = 0; i < statements.Length; i++) { var statement = statements[i]; if (statement.StatementType == StatementType.Var) { var parsed = ParseVarStatement(processor, statement); if (parsed.Item1.Identifier == ClassMethodCtor) { processor.ErrorHandler.ThrowError(ErrorType.SyntaxError, ErrorHandler.MessageSyntaxMissingVarName); } prototype.AddMember(processor, parsed.Item1); if (parsed.Item2.Length > 0) { if (parsed.Item1.IsStatic) { staticCtorCode += string.Format(FormatVarAssignment, parsed.Item1.Identifier, parsed.Item2); } else { additionalCtorCode += string.Format(FormatVarAssignment, parsed.Item1.Identifier, parsed.Item2); } } } else if (statement.StatementType == StatementType.Function) { i++; if (statements.Length > i) { var bodyStatement = statements[i]; var parsed = ParseFunctionStatement(processor, statement, bodyStatement); if (parsed.Identifier == ClassMethodCtor) { if (prototype.Constructor != null) { processor.ErrorHandler.ThrowError(ErrorType.SyntaxError, ErrorHandler.MessageSyntaxClassDuplicateDefinition, parsed.Identifier, identifier); } prototype.Constructor = parsed; } else { prototype.AddMember(processor, parsed); } } else { return(processor.ErrorHandler.ThrowError(ErrorType.SyntaxError, ErrorHandler.MessageSyntaxExpectedExpression, "end of script")); } } else { processor.ErrorHandler.ThrowError(ErrorType.SyntaxError, ErrorHandler.MessageSyntaxClassInvalidStatement); } } // Add additional constructor code & static constructor code to prototype: if (staticCtorCode.Length > 0) { prototype._staticConstructor = new SFunction(staticCtorCode, new string[] { }); prototype._staticConstructorProcessor = processor; } if (additionalCtorCode.Length > 0) { if (prototype.Constructor == null) { // Create new ctor if no one has been defined: prototype.Constructor = new PrototypeMember(ClassMethodCtor, new SFunction("", new string[] { }), false, true, false, false); } prototype.Constructor.ToFunction().Body = additionalCtorCode + prototype.Constructor.ToFunction().Body; } return(prototype); } else { return(processor.ErrorHandler.ThrowError(ErrorType.SyntaxError, ErrorHandler.MessageSyntaxInvalidClassSignature)); } }
public DataUpdater(IConfiguration config, ITransactionRepository transactionRepository) { Config = config; TransactionRepository = transactionRepository; Processor = new StatementProcessor(Config["FileDirectory"]); }