public void TestInvalidRoutes(string routeString) { var mockEndpointFactory = new Mock <IEndpointFactory>(); mockEndpointFactory.Setup(s => s.CreateSystemEndpoint(It.IsAny <string>())).Returns(new TestEndpoint("SystemEndpoint")); mockEndpointFactory.Setup(s => s.CreateFunctionEndpoint(It.IsAny <string>(), It.IsAny <string>())).Returns(new TestEndpoint("FunctionEndpoint")); var routeFactory = new TestRouteFactory(mockEndpointFactory.Object); Assert.Throws <RouteCompilationException>(() => routeFactory.Create(routeString)); }
public void TestParseRouteWithSystemEndpoint(string routeString, IMessageSource expectedSource, string expectedCondition, string systemEndpoint) { var mockEndpointFactory = new Mock <IEndpointFactory>(); mockEndpointFactory.Setup(ef => ef.CreateSystemEndpoint( It.Is <string>(s => s.Equals(systemEndpoint, StringComparison.OrdinalIgnoreCase)))) .Returns(new TestEndpoint(systemEndpoint)); var routeFactory = new TestRouteFactory(mockEndpointFactory.Object); routeFactory.ParseRoute(routeString, out IMessageSource messageSource, out string condition, out Endpoint endpoint); Assert.NotNull(messageSource); Assert.True(expectedSource.Equals(messageSource)); Assert.NotNull(condition); Assert.Equal(expectedCondition, condition); Assert.NotNull(endpoint); Assert.Equal(systemEndpoint, endpoint.Name); }