public void Test_ReceiverSetup_Validate() { // Arrange var receiverSetup = new ReceiverConfig() { CreateEntityIfNotExists = false, EntityName = "", PollFrequencyInSeconds = 1, RemoveSerializationFailureMessages = false }; // Act/Assert Assert.Throws <ValidateException>(() => receiverSetup.ThrowIfInvalid()); Assert.False(receiverSetup.CreateEntityIfNotExists); Assert.True(receiverSetup.EntityName == ""); Assert.Equal(1, receiverSetup.PollFrequencyInSeconds); Assert.False(receiverSetup.RemoveSerializationFailureMessages); receiverSetup.ToString().Should().NotBeNullOrEmpty(); }
public void Test_ReceiverConfig_ToStringFunctionality() { // Arrange var config = new ReceiverConfig { EntityName = "entityName", EntitySubscriptionName = "subscriptionName", CreateEntityIfNotExists = true, EntityFilter = new KeyValuePair <string, string>("testkey", "testfilter"), ProjectId = "12345", ReadFromErrorEntity = true }; // Act var str = config.ToString(); // Assert str.Should().Be("EntityName: entityName, EntityDeadLetterName: entityName_deadletter, EntitySubscriptionName: subscriptionName, " + "EntityDeadLetterSubscriptionName: entityName_deadletter_default, EntityFilter: [testkey, testfilter], CreateEntityIfNotExists: True, ReadFromErrorEntity: True"); }
public void Test_ReceiverConfig_Setup() { // Arrange var receiver = new ReceiverConfig { EntityName = "entityName", EntitySubscriptionName = "test", ReadFromErrorEntity = true, CreateEntityIfNotExists = false, EntityFilter = new KeyValuePair <string, string>("key", "value"), ProjectId = "projId" }; // Assert receiver.TopicRelativeName.Should().Be($"projects/projId/topics/entityName"); receiver.EntityDeadLetterName.Should().Be($"entityName_deadletter"); receiver.TopicDeadletterRelativeName.Should().Be($"projects/projId/topics/entityName_deadletter"); receiver.ToString().Length.Should().BeGreaterThan(0); receiver.ProjectId.Should().Be("projId"); receiver.ReadFromErrorEntity.Should().BeTrue(); }