Exemplo n.º 1
0
        public void WithTypeReturningCollectionsHavingFunctions()
        {
            var tester = new JsonExecutor(ReadTestFile("MethodReturningPersonCollectionsHavingFunctions.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
Exemplo n.º 2
0
        public void FunctoidsInExpectedWhichReturnsDictionary()
        {
            var tester = new JsonExecutor(ReadTestFile("MathFuctionsInExpected.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
Exemplo n.º 3
0
        public void MethodTakingDictionary()
        {
            var tester = new JsonExecutor(ReadTestFile("MethodTakingDictionary.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
Exemplo n.º 4
0
        public void ExceptionTest()
        {
            var tester = new JsonExecutor(ReadTestFile("ExpectedExceptionTest.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
Exemplo n.º 5
0
        public void ExtractPlainStringReturnMethodInToVariableAndUseInNextTest()
        {
            var tester = new JsonExecutor(ReadTestFile("ExtractStrigToVariable.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
Exemplo n.º 6
0
        public void TestWithMethodReturnResults()
        {
            var tester = new JsonExecutor(ReadTestFile("Math.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
Exemplo n.º 7
0
        public void DefineVariableWithFunctions()
        {
            var tester = new JsonExecutor(ReadTestFile("DefineVariableWithFunctions.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
Exemplo n.º 8
0
        public void WithEnumOfInts()
        {
            var tester = new JsonExecutor(ReadTestFile("MethodTakingArrayOfInt.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
Exemplo n.º 9
0
        public void TestWithMethodReturnStringArrayWithFunctoidsInDictionary()
        {
            var tester = new JsonExecutor(ReadTestFile("MethodReturnStringArrayDictionaryWithFunctoids.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
Exemplo n.º 10
0
        public void ExtractStringToVariableUsingExtracts()
        {
            var tester = new JsonExecutor(ReadTestFile("ExtractStringToVariableUsingExtracts.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
Exemplo n.º 11
0
        public void TestWithMethodReturnDictionaryHavingExpectedFunctiods()
        {
            var tester = new JsonExecutor(ReadTestFile("MethodReturnDictionaryWithFunctoidsInExpected.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
Exemplo n.º 12
0
        public void BuiltinTypeRandomMethod()
        {
            var tester = new JsonExecutor(ReadTestFile("BuiltinTypeRandomMethod.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
Exemplo n.º 13
0
        public void ForPartialArrayValidation()
        {
            var tester = new JsonExecutor(ReadTestFile("MethodReturnStringArrayDictionaryContainValidation.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
Exemplo n.º 14
0
        public void TestWithMethodInputAsFunctionsHavingArguments()
        {
            var tester = new JsonExecutor(ReadTestFile("MethodInputAsFunctoidWithArgs.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
Exemplo n.º 15
0
        public void TestWithParametersWithVariables()
        {
            var tester = new JsonExecutor(ReadTestFile("MathWithVariableInArguments.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
                { "mynum1", 99 }
            });
        }
Exemplo n.º 16
0
        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.");
        }
Exemplo n.º 17
0
        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>();
        }
Exemplo n.º 18
0
        public void MethodTakingDictionaryWithVariables()
        {
            var tester = new JsonExecutor(ReadTestFile("MethodTakingDictionaryWithVariables.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
                { "item1", "val1" },
                { "item2", "val2" }
            });
        }
Exemplo n.º 19
0
        public void TestWithMethodInputAsFunctionsHavingVariablesInArguments()
        {
            var tester = new JsonExecutor(ReadTestFile("MethodInputAsFunctoidWithVariablesInArgs.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
                { "mynum1", 101 },
                { "mynum2", 202 }
            });
        }
Exemplo n.º 20
0
        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);
        }
Exemplo n.º 21
0
        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("==========================");
        }
Exemplo n.º 22
0
        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);
        }
Exemplo n.º 23
0
        /// <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);
                }
            });
        }
Exemplo n.º 24
0
 internal SlotExecutor(SaveIO saveIo)
 {
     _saveIo       = saveIo;
     _jsonExecutor = saveIo.RequestJsonExecutor();
 }
Exemplo n.º 25
0
 private string GetPath(JsonExecutor jsonExecutor)
 {
     return($"{Application.persistentDataPath}/{jsonExecutor.GetFilename()}.json");
 }
Exemplo n.º 26
0
 private bool DoesExist(JsonExecutor jsonExecutor)
 {
     return(File.Exists(GetPath(jsonExecutor)));
 }