public void GenerateJson_VALID() { JsonGenerator jsonGenerator = new JsonGenerator(); string result = jsonGenerator.Generate(10); Assert.True(result != String.Empty); Assert.True(JsonValidator.IsJsonValid(result)); }
public void GenerateJson_INVALID_NUMBER() { JsonGenerator jsonGenerator = new JsonGenerator(); string result = jsonGenerator.Generate(-1); Assert.True(result == String.Empty); Assert.False(JsonValidator.IsJsonValid(result)); }
private void Parse(ValidatorTabViewModel vm, object parameter) { try { var webBrowser = ((WebBrowser)parameter); string jsonErrorHtml; string errorMessage; if (JsonValidator.IsJsonValid(JsonToParse, out jsonErrorHtml, out errorMessage)) { webBrowser.InvokeScript(DisplayValidJsonFunctionName, JsonToParse, WordWrap); } else { webBrowser.InvokeScript(DisplayInvalidJsonFunctionName, jsonErrorHtml, errorMessage, WordWrap); } } catch (Exception e) { MessageBox.Show("Error while executing Javascript: " + e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void JsonValidator_INVALID_NULL() { Assert.False(JsonValidator.IsJsonValid(null)); }
public void JsonValidator_INVALID_WITH_ERRORS() { Assert.False(JsonValidator.IsJsonValid(jsonWithErrors)); }
public void JsonValidator_INVALID() { Assert.False(JsonValidator.IsJsonValid(notJson)); }
public void JsonValidator_VALID_ALL() { Assert.True(JsonValidator.IsJsonValid(jsonValid)); }