public void CompareToTests() { // Note: the id and schema strings are not valid, however checking this // is considered outside the scope of the CompareTo function. var schema1 = new RegisteredSchema("test-a", 1, 42, "test-schema-string", SchemaType.Avro, new List <SchemaReference>()); var schema2 = new RegisteredSchema("test-b", 2, 42, "test-schema-string", SchemaType.Avro, new List <SchemaReference>()); Assert.True(schema1.CompareTo(schema2) < 0); Assert.True(schema2.CompareTo(schema1) > 0); var schema3 = new RegisteredSchema("test-c", 4, 42, "test-schema-string", SchemaType.Avro, new List <SchemaReference>()); var schema4 = new RegisteredSchema("test-d", 3, 42, "test-schema-string", SchemaType.Avro, new List <SchemaReference>()); Assert.True(schema3.CompareTo(schema4) < 0); Assert.True(schema4.CompareTo(schema3) > 0); var schema5 = new RegisteredSchema("test-b", 2, 42, "test-schema-string", SchemaType.Avro, new List <SchemaReference>()); Assert.Equal(0, schema2.CompareTo(schema5)); var schema6 = new RegisteredSchema("test-a", 2, 42, "test-schema-string", SchemaType.Avro, new List <SchemaReference>()); Assert.True(schema1.CompareTo(schema6) < 0); Assert.True(schema6.CompareTo(schema1) > 0); var schema7 = new RegisteredSchema("test-b", 1, 42, "test-schema-string", SchemaType.Avro, new List <SchemaReference>()); Assert.True(schema1.CompareTo(schema7) < 0); Assert.True(schema7.CompareTo(schema1) > 0); }
public void CompareTo_Same() { var schema1 = new RegisteredSchema("test-key", 1, 42, "test-schema-string", SchemaType.Protobuf, new List <SchemaReference>()); var schema2 = new RegisteredSchema("test-key", 1, 42, "test-schema-string", SchemaType.Protobuf, new List <SchemaReference>()); Assert.Equal(0, schema1.CompareTo(schema2)); }