public void IncorrectConfigurationInterface() { var mockSchemaClient = new MockSchemaRegistryClient(); var config = new Mock <IStreamConfig>(); var serdes = new MockProtoSerDes(mockSchemaClient); Assert.Throws <StreamConfigException>(() => serdes.Initialize(new Net.SerDes.SerDesContext(config.Object))); }
public void DefaultSchemaRegistryConfig() { var mockSchemaClient = new MockSchemaRegistryClient(); var config = new StreamConfig(); var serdes = new MockProtoSerDes(mockSchemaClient); serdes.Initialize(new Net.SerDes.SerDesContext(config)); Assert.AreEqual(100, mockSchemaClient.MaxCachedSchemas); Assert.AreEqual(30000, mockSchemaClient.RequestTimeoutMs); }
public void SerializeOK() { var mockSchemaClient = new MockSchemaRegistryClient(); var config = new StreamConfig(); var serdes = new MockProtoSerDes(mockSchemaClient); serdes.Initialize(new Net.SerDes.SerDesContext(config)); var person = new Helpers.Proto.Person { Age = 18, FirstName = "TEST", LastName = "TEST" }; var bytes = serdes.Serialize(person, new Confluent.Kafka.SerializationContext(Confluent.Kafka.MessageComponentType.Value, topic)); Assert.IsNotNull(bytes); Assert.IsTrue(bytes.Length > 0); }
public void SchemaRegistryConfig() { var mockSchemaClient = new MockSchemaRegistryClient(); var config = new StreamConfig(); config.AutoRegisterSchemas = true; config.SchemaRegistryMaxCachedSchemas = 1; config.SchemaRegistryRequestTimeoutMs = 30; config.SubjectNameStrategy = SubjectNameStrategy.TopicRecord; var serdes = new MockProtoSerDes(mockSchemaClient); serdes.Initialize(new Net.SerDes.SerDesContext(config)); Assert.AreEqual(1, mockSchemaClient.MaxCachedSchemas); Assert.AreEqual(30, mockSchemaClient.RequestTimeoutMs); }