zcsizmadia commented on a change in pull request #1571:
URL: https://github.com/apache/avro/pull/1571#discussion_r822792182
##########
File path: lang/csharp/src/apache/test/Schema/SchemaTests.cs
##########
@@ -439,5 +439,57 @@ public void TestUnionSchemaWithoutTypeProperty(string
schemaJson, string expecte
var schema = Schema.Parse(schemaJson);
Assert.AreEqual(schema.ToString(), expectedSchemaJson);
}
+
+ [TestFixture]
+ public class SchemaTypeExtensionsTests
+ {
+ [TestCase("null", Schema.Type.Null)]
+ [TestCase("boolean", Schema.Type.Boolean)]
+ [TestCase("int", Schema.Type.Int)]
+ [TestCase("long", Schema.Type.Long)]
+ [TestCase("float", Schema.Type.Float)]
+ [TestCase("double", Schema.Type.Double)]
+ [TestCase("bytes", Schema.Type.Bytes)]
+ [TestCase("string", Schema.Type.String)]
+ [TestCase("record", Schema.Type.Record)]
+ [TestCase("enumeration", Schema.Type.Enumeration)]
+ [TestCase("array", Schema.Type.Array)]
+ [TestCase("map", Schema.Type.Map)]
+ [TestCase("union", Schema.Type.Union)]
+ [TestCase("fixed", Schema.Type.Fixed)]
+ [TestCase("error", Schema.Type.Error)]
+ [TestCase("logical", Schema.Type.Logical)]
+ [TestCase("Logical", null)]
+ [TestCase("InvalidValue", null)]
+ [TestCase("\"null\"", null)]
+ [TestCase("", null)]
+ [TestCase(null, null)]
+ public void ParseTypeTest(string value, object expectedResult)
Review comment:
The same as below
##########
File path: lang/csharp/src/apache/test/Schema/SchemaTests.cs
##########
@@ -439,5 +439,57 @@ public void TestUnionSchemaWithoutTypeProperty(string
schemaJson, string expecte
var schema = Schema.Parse(schemaJson);
Assert.AreEqual(schema.ToString(), expectedSchemaJson);
}
+
+ [TestFixture]
+ public class SchemaTypeExtensionsTests
+ {
+ [TestCase("null", Schema.Type.Null)]
+ [TestCase("boolean", Schema.Type.Boolean)]
+ [TestCase("int", Schema.Type.Int)]
+ [TestCase("long", Schema.Type.Long)]
+ [TestCase("float", Schema.Type.Float)]
+ [TestCase("double", Schema.Type.Double)]
+ [TestCase("bytes", Schema.Type.Bytes)]
+ [TestCase("string", Schema.Type.String)]
+ [TestCase("record", Schema.Type.Record)]
+ [TestCase("enumeration", Schema.Type.Enumeration)]
+ [TestCase("array", Schema.Type.Array)]
+ [TestCase("map", Schema.Type.Map)]
+ [TestCase("union", Schema.Type.Union)]
+ [TestCase("fixed", Schema.Type.Fixed)]
+ [TestCase("error", Schema.Type.Error)]
+ [TestCase("logical", Schema.Type.Logical)]
+ [TestCase("Logical", null)]
+ [TestCase("InvalidValue", null)]
+ [TestCase("\"null\"", null)]
+ [TestCase("", null)]
+ [TestCase(null, null)]
+ public void ParseTypeTest(string value, object expectedResult)
+ {
+ if (expectedResult is Schema.Type expectedType)
+ {
+ Assert.AreEqual(Schema.ParseType(value), expectedType);
+ }
+ else
+ {
+ Assert.AreEqual(Schema.ParseType(value), expectedResult);
+ }
+ }
+
+ [TestCase("\"null\"", Schema.Type.Null)]
+ [TestCase("\"nu\"ll\"", null)]
+ [TestCase("\"\"", null)]
+ public void ParseTypeRemoveQuotesTest(string value, object
expectedResult)
Review comment:
In this case keeping previous patterns dont really matter. The test code
iotself seems to me over complicated. I really do prefer to use good patterns
where it can live side by side with existing code patterns
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]