Exemplo n.º 1
0
 private static string CreateErrorMessage(SchemaError error)
 {
     if (error.Type == null)
     {
         return(error.Message);
     }
     else
     {
         return($"{error.Message} - Type: {error.Type.Name}");
     }
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }