コード例 #1
0
        public void WithTypeReturningCollectionsHavingFunctions()
        {
            var tester = new JsonExecutor(ReadTestFile("MethodReturningPersonCollectionsHavingFunctions.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
コード例 #2
0
        public void FunctoidsInExpectedWhichReturnsDictionary()
        {
            var tester = new JsonExecutor(ReadTestFile("MathFuctionsInExpected.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
コード例 #3
0
        public void MethodTakingDictionary()
        {
            var tester = new JsonExecutor(ReadTestFile("MethodTakingDictionary.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
コード例 #4
0
        public void ExceptionTest()
        {
            var tester = new JsonExecutor(ReadTestFile("ExpectedExceptionTest.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
コード例 #5
0
        public void ExtractPlainStringReturnMethodInToVariableAndUseInNextTest()
        {
            var tester = new JsonExecutor(ReadTestFile("ExtractStrigToVariable.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
コード例 #6
0
        public void TestWithMethodReturnResults()
        {
            var tester = new JsonExecutor(ReadTestFile("Math.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
コード例 #7
0
        public void DefineVariableWithFunctions()
        {
            var tester = new JsonExecutor(ReadTestFile("DefineVariableWithFunctions.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
コード例 #8
0
        public void WithEnumOfInts()
        {
            var tester = new JsonExecutor(ReadTestFile("MethodTakingArrayOfInt.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
コード例 #9
0
        public void TestWithMethodReturnStringArrayWithFunctoidsInDictionary()
        {
            var tester = new JsonExecutor(ReadTestFile("MethodReturnStringArrayDictionaryWithFunctoids.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
コード例 #10
0
        public void ExtractStringToVariableUsingExtracts()
        {
            var tester = new JsonExecutor(ReadTestFile("ExtractStringToVariableUsingExtracts.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
コード例 #11
0
        public void TestWithMethodReturnDictionaryHavingExpectedFunctiods()
        {
            var tester = new JsonExecutor(ReadTestFile("MethodReturnDictionaryWithFunctoidsInExpected.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
コード例 #12
0
        public void BuiltinTypeRandomMethod()
        {
            var tester = new JsonExecutor(ReadTestFile("BuiltinTypeRandomMethod.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
コード例 #13
0
        public void ForPartialArrayValidation()
        {
            var tester = new JsonExecutor(ReadTestFile("MethodReturnStringArrayDictionaryContainValidation.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
コード例 #14
0
        public void TestWithMethodInputAsFunctionsHavingArguments()
        {
            var tester = new JsonExecutor(ReadTestFile("MethodInputAsFunctoidWithArgs.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
            });
        }
コード例 #15
0
        public void TestWithParametersWithVariables()
        {
            var tester = new JsonExecutor(ReadTestFile("MathWithVariableInArguments.json"), ReadTestFile("config.json"), msg => { });

            tester.ExecuteAndVerify(new Dictionary <string, object>()
            {
                { "mynum1", 99 }
            });
        }
コード例 #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.");
        }
コード例 #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>();
        }
コード例 #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" }
            });
        }
コード例 #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 }
            });
        }
コード例 #20
0
ファイル: SaveIO.cs プロジェクト: GreenTea-M/ProjectPengi
        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);
        }
コード例 #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("==========================");
        }
コード例 #22
0
ファイル: SaveIO.cs プロジェクト: GreenTea-M/ProjectPengi
        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);
        }
コード例 #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);
                }
            });
        }
コード例 #24
0
ファイル: SaveIO.cs プロジェクト: GreenTea-M/ProjectPengi
 internal SlotExecutor(SaveIO saveIo)
 {
     _saveIo       = saveIo;
     _jsonExecutor = saveIo.RequestJsonExecutor();
 }
コード例 #25
0
ファイル: SaveIO.cs プロジェクト: GreenTea-M/ProjectPengi
 private string GetPath(JsonExecutor jsonExecutor)
 {
     return($"{Application.persistentDataPath}/{jsonExecutor.GetFilename()}.json");
 }
コード例 #26
0
ファイル: SaveIO.cs プロジェクト: GreenTea-M/ProjectPengi
 private bool DoesExist(JsonExecutor jsonExecutor)
 {
     return(File.Exists(GetPath(jsonExecutor)));
 }