예제 #1
0
        private bool ValidateJson(ApplicationOptions options, string jsonFileSrcPath, out string errorMessage)
        {
            errorMessage = string.Empty;
            var outputDir   = Path.GetTempPath();
            var jsonText    = File.ReadAllText(jsonFileSrcPath);
            var optionsJson = options.Json.Replace(this_TestCaseProject.FullPath.Replace("\\", "/"), "$testCaseProject$");

            if (optionsJson.Trim() != jsonText.Trim())
            {
                var outJsonFile = Path.Combine(outputDir, Path.GetFileName(jsonFileSrcPath));
                File.WriteAllText(outJsonFile, options.Json);
                errorMessage = $"{options.GetType().Name} did not pass serialization roundtrip!{Environment.NewLine}  windiff {jsonFileSrcPath} {outJsonFile}";
                return(false);
            }
            return(true);
        }