private static string CreateErrorMessage(SchemaError error) { if (error.Type == null) { return(error.Message); } else { return($"{error.Message} - Type: {error.Type.Name}"); } }
public void CreateSchemaError_TwoArguments_PopertiesAreSet() { // arrange var message = "FooBar"; var exception = new Exception(); // act var schemaError = new SchemaError(message, exception); // assert Assert.Equal(message, schemaError.Message); Assert.Equal(exception, schemaError.AssociatedException); Assert.Null(schemaError.SyntaxNode); Assert.Null(schemaError.Type); }
public void CreateSchemaError_FourArguments_PopertiesAreSet() { // arrange var message = "FooBar"; var exception = new Exception(); // act var schemaError = new SchemaError( message, new StringType(), new NameNode("foo"), exception); // assert Assert.Equal(message, schemaError.Message); Assert.Equal(exception, schemaError.AssociatedException); Assert.IsType <NameNode>(schemaError.SyntaxNode); Assert.IsType <StringType>(schemaError.Type); }