public void ValidateBridgeConfig_ValidInput() { var validator = new BrokerPropertiesValidator(); EdgeHubDesiredProperties properties = ConfigTestData.GetTestData(); IList <string> errors = validator.ValidateBridgeConfig(properties.BrokerConfiguration.Bridges); Assert.Equal(0, errors.Count); }
public void ValidateBridgeConfig_InvalidTopicOrPrefix() { var validator = new BrokerPropertiesValidator(); var bridgeConfig = new BridgeConfig { new Bridge("$upstream", new List <Settings> { new Settings(Direction.In, "topic/#/a", "local/#", "remote/+/") }) }; IList <string> errors = validator.ValidateBridgeConfig(bridgeConfig); Assert.Equal(3, errors.Count); Assert.Equal("Bridge 0: Topic is invalid: topic/#/a", errors[0]); Assert.Equal("Bridge 0: InPrefix must not contain wildcards (+, #)", errors[1]); Assert.Equal("Bridge 0: OutPrefix must not contain wildcards (+, #)", errors[2]); }
public void ValidateBridgeConfig_EmptyElements() { var validator = new BrokerPropertiesValidator(); var bridgeConfig = new BridgeConfig { new Bridge(string.Empty, new List <Settings> { new Settings(Direction.In, string.Empty, string.Empty, string.Empty) }), new Bridge("floor2", new List <Settings> { }) }; IList <string> errors = validator.ValidateBridgeConfig(bridgeConfig); Assert.Equal(2, errors.Count); Assert.Equal("Bridge 0: Endpoint must not be empty", errors[0]); Assert.Equal("Bridge 1: Settings must not be empty", errors[1]); }