Esempio n. 1
0
        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);
        }