private ExecutedCodeProperties CallCsharpExecuter(ProgramProperties programProperties, ExecutedCodeProperties executedCodeProperties) { CsharpCodeExecuter csharpCodeExecuter = new CsharpCodeExecuter(programProperties, _excecutedCodeProperties); CodeExecuter codeExecuter = new CodeExecuter(csharpCodeExecuter); return(codeExecuter.Execute()); }
public void ExecuteCode_正常系() { var executer = new CodeExecuter(); var p = new PrivateObject(executer); //現在時点で3回足す executer.ExecuteCode("+++"); var array = (int[])p.GetField("_pointer"); Assert.AreEqual(3, array[0]); }
public void IsPointerValueZero_正常系() { var executer = new CodeExecuter(); var p = new PrivateObject(executer); p.SetField("_pointer", new int[] { 0, 1 }); p.SetField("_pointerPosition", 0); Assert.AreEqual(true, (bool)p.Invoke("IsPointerValueZero")); p.SetField("_pointerPosition", 1); Assert.AreEqual(false, (bool)p.Invoke("IsPointerValueZero")); }
public void PlusMinusPointerValue_正常系() { var executer = new CodeExecuter(); var p = new PrivateObject(executer); var pointerPosition = (int)p.GetField("_pointerPosition"); var pointerArray = (int[])p.GetField("_pointer"); //ポインターの値を変える p.Invoke("PlusMinusPointerValue", new object[] { 1 }); Assert.AreEqual(1, pointerArray[0]); p.Invoke("PlusMinusPointerValue", new object[] { -1 }); Assert.AreEqual(0, pointerArray[0]); }
public string Execute(string code) { var engine = new CodeExecuter(); try { var unformatted = engine.Execute(code); return(FormatResult(unformatted)); } catch (Exception ex) { EventLog.WriteEntry("RossieEngineService", ex.ToString(), EventLogEntryType.Error); } return(string.Empty); }
public void MovePointer_正常系() { var executer = new CodeExecuter(); var p = new PrivateObject(executer); var pointerPosition = (int)p.GetField("_pointerPosition"); var pointerArray = (int[])p.GetField("_pointer"); //ポインターを動かす p.Invoke("MovePointer", new object[] { 1 }); pointerPosition = (int)p.GetField("_pointerPosition"); pointerArray = (int[])p.GetField("_pointer"); Assert.AreEqual(1, pointerPosition); pointerPosition = (int)p.GetField("_pointerPosition"); pointerArray = (int[])p.GetField("_pointer"); //ポインターを表す配列の数値が変動する Assert.AreEqual(2, pointerArray.Length); p.Invoke("MovePointer", new object[] { -1 }); pointerPosition = (int)p.GetField("_pointerPosition"); pointerArray = (int[])p.GetField("_pointer"); Assert.AreEqual(0, pointerPosition); p.Invoke("MovePointer", new object[] { -1 }); pointerPosition = (int)p.GetField("_pointerPosition"); pointerArray = (int[])p.GetField("_pointer"); Assert.AreEqual(0, pointerPosition); //ポインターを表す配列の数値が変動する Assert.AreEqual(3, pointerArray.Length); }
public MainWindow() { InitializeComponent(); _codeExecuter = new CodeExecuter(); }