public void WithTypeReturningCollectionsHavingFunctions() { var tester = new JsonExecutor(ReadTestFile("MethodReturningPersonCollectionsHavingFunctions.json"), ReadTestFile("config.json"), msg => { }); tester.ExecuteAndVerify(new Dictionary <string, object>() { }); }
public void FunctoidsInExpectedWhichReturnsDictionary() { var tester = new JsonExecutor(ReadTestFile("MathFuctionsInExpected.json"), ReadTestFile("config.json"), msg => { }); tester.ExecuteAndVerify(new Dictionary <string, object>() { }); }
public void MethodTakingDictionary() { var tester = new JsonExecutor(ReadTestFile("MethodTakingDictionary.json"), ReadTestFile("config.json"), msg => { }); tester.ExecuteAndVerify(new Dictionary <string, object>() { }); }
public void ExceptionTest() { var tester = new JsonExecutor(ReadTestFile("ExpectedExceptionTest.json"), ReadTestFile("config.json"), msg => { }); tester.ExecuteAndVerify(new Dictionary <string, object>() { }); }
public void ExtractPlainStringReturnMethodInToVariableAndUseInNextTest() { var tester = new JsonExecutor(ReadTestFile("ExtractStrigToVariable.json"), ReadTestFile("config.json"), msg => { }); tester.ExecuteAndVerify(new Dictionary <string, object>() { }); }
public void TestWithMethodReturnResults() { var tester = new JsonExecutor(ReadTestFile("Math.json"), ReadTestFile("config.json"), msg => { }); tester.ExecuteAndVerify(new Dictionary <string, object>() { }); }
public void DefineVariableWithFunctions() { var tester = new JsonExecutor(ReadTestFile("DefineVariableWithFunctions.json"), ReadTestFile("config.json"), msg => { }); tester.ExecuteAndVerify(new Dictionary <string, object>() { }); }
public void WithEnumOfInts() { var tester = new JsonExecutor(ReadTestFile("MethodTakingArrayOfInt.json"), ReadTestFile("config.json"), msg => { }); tester.ExecuteAndVerify(new Dictionary <string, object>() { }); }
public void TestWithMethodReturnStringArrayWithFunctoidsInDictionary() { var tester = new JsonExecutor(ReadTestFile("MethodReturnStringArrayDictionaryWithFunctoids.json"), ReadTestFile("config.json"), msg => { }); tester.ExecuteAndVerify(new Dictionary <string, object>() { }); }
public void ExtractStringToVariableUsingExtracts() { var tester = new JsonExecutor(ReadTestFile("ExtractStringToVariableUsingExtracts.json"), ReadTestFile("config.json"), msg => { }); tester.ExecuteAndVerify(new Dictionary <string, object>() { }); }
public void TestWithMethodReturnDictionaryHavingExpectedFunctiods() { var tester = new JsonExecutor(ReadTestFile("MethodReturnDictionaryWithFunctoidsInExpected.json"), ReadTestFile("config.json"), msg => { }); tester.ExecuteAndVerify(new Dictionary <string, object>() { }); }
public void BuiltinTypeRandomMethod() { var tester = new JsonExecutor(ReadTestFile("BuiltinTypeRandomMethod.json"), ReadTestFile("config.json"), msg => { }); tester.ExecuteAndVerify(new Dictionary <string, object>() { }); }
public void ForPartialArrayValidation() { var tester = new JsonExecutor(ReadTestFile("MethodReturnStringArrayDictionaryContainValidation.json"), ReadTestFile("config.json"), msg => { }); tester.ExecuteAndVerify(new Dictionary <string, object>() { }); }
public void TestWithMethodInputAsFunctionsHavingArguments() { var tester = new JsonExecutor(ReadTestFile("MethodInputAsFunctoidWithArgs.json"), ReadTestFile("config.json"), msg => { }); tester.ExecuteAndVerify(new Dictionary <string, object>() { }); }
public void TestWithParametersWithVariables() { var tester = new JsonExecutor(ReadTestFile("MathWithVariableInArguments.json"), ReadTestFile("config.json"), msg => { }); tester.ExecuteAndVerify(new Dictionary <string, object>() { { "mynum1", 99 } }); }
public void MathFunctionFaileShouldThrowException() { var tester = new JsonExecutor(ReadTestFile("ExpectedDidNotMatch.json"), ReadTestFile("config.json"), msg => { }); Action verify = () => tester.ExecuteAndVerify(new Dictionary <string, object>() { }); verify.Should().Throw <AssertionException>().WithMessage("Expected actual to be 130L because Math.Add result did fail, but found 30."); }
public void WithMethodReturnNullButTestCaseExpectingNonNull() { var tester = new JsonExecutor(ReadTestFile("MethodReturningNullExpectingNonNull.json"), ReadTestFile("config.json"), msg => { }); Action expectationsFailed = () => tester.ExecuteAndVerify(new Dictionary <string, object>() { }); expectationsFailed.Should().Throw <AssertionException>(); }
public void MethodTakingDictionaryWithVariables() { var tester = new JsonExecutor(ReadTestFile("MethodTakingDictionaryWithVariables.json"), ReadTestFile("config.json"), msg => { }); tester.ExecuteAndVerify(new Dictionary <string, object>() { { "item1", "val1" }, { "item2", "val2" } }); }
public void TestWithMethodInputAsFunctionsHavingVariablesInArguments() { var tester = new JsonExecutor(ReadTestFile("MethodInputAsFunctoidWithVariablesInArgs.json"), ReadTestFile("config.json"), msg => { }); tester.ExecuteAndVerify(new Dictionary <string, object>() { { "mynum1", 101 }, { "mynum2", 202 } }); }
private string LoadJsonString(JsonExecutor jsonExecutor) { var path = GetPath(jsonExecutor); if (File.Exists(path)) { jsonExecutor.UsingJsonData(File.ReadAllText(path)); return(jsonExecutor.GetJsonString()); } Debug.LogError("Save file not found in path: " + path); return(null); }
public void TestWithMethodInputAsFunctions() { var tester = new JsonExecutor(ReadTestFile("MethodInputAsFunctoid.json"), ReadTestFile("config.json"), msg => { }); var results = tester.Execute(new Dictionary <string, object>() { }); Console.WriteLine("=========================="); foreach (var kv in results) { Console.WriteLine($"{kv.Key} {kv.Value}"); } Console.WriteLine("=========================="); }
private bool OverwriteJson(JsonExecutor jsonExecutor) { if (jsonExecutor.GetFilename() == null) { return(false); } string path = GetPath(jsonExecutor); File.WriteAllText(path, jsonExecutor.GetJsonString()); #if UNITY_WEBGL if (Application.platform == RuntimePlatform.WebGLPlayer) { SyncFiles(); } #endif return(true); }
/// <summary> /// Executes the test. /// </summary> /// <param name="isVerify"> /// true for verifying the results with expected one. /// </param> /// <returns> /// Task instance. /// </returns> public async Task Execute(bool isVerify) { await new TaskFactory().StartNew(() => { try { this.TraceMessages.Clear(); this.TestStatus = TestStatus.Running; var executor = new JsonExecutor(this.Data, this.ConfigJson, this.TraceAction); if (isVerify) { executor.ExecuteAndVerify(this.Variables); this.ResultsData = "Success"; } else { var output = executor.Execute(this.Variables); this.ResultsData = JsonConvert.SerializeObject(output); } this.TestStatus = TestStatus.Success; } catch (AssertionFailedException ae) { this.TestStatus = TestStatus.Error; this.ResultsData = ae.Message; // good with message. } catch (Exception e) { this.TestStatus = TestStatus.Error; this.ResultsData = e.ToString(); } finally { this.OnPropertyChanged(() => this.ResultsData); this.OnPropertyChanged(() => this.TestStatus); } }); }
internal SlotExecutor(SaveIO saveIo) { _saveIo = saveIo; _jsonExecutor = saveIo.RequestJsonExecutor(); }
private string GetPath(JsonExecutor jsonExecutor) { return($"{Application.persistentDataPath}/{jsonExecutor.GetFilename()}.json"); }
private bool DoesExist(JsonExecutor jsonExecutor) { return(File.Exists(GetPath(jsonExecutor))); }