public RouteAnalyzerFixture(ServiceExtensions.ReactiveServicesOption option, int count, Action <RouteCollection> analyzer = null) { ServiceCollection = new ServiceCollection(); _analyzer = analyzer; _serviceOption = option; _count = count; }
public void service_calls_are_registered_as_routes(ServiceExtensions.ReactiveServicesOption option, int count) { var builder = new RouteAnalyzerFixture( option, count, routes => { var routePaths = new string[routes.Count]; for (int i = 0; i < routes.Count; i++) { var route = routes[i]; routePaths[i] = route.ToString(); } Assert.Equal(count, routes.Count); if (option == ServiceExtensions.ReactiveServicesOption.None) { return; } var paths = new TestServiceImpl().Descriptor.Calls.Select(x => x.CallId) .Cast <RestCallId>() .ToArray() .Select(x => x.PathPattern) .ToArray(); Assert.Equal(count, paths.Length); foreach (var path in routePaths) { Assert.Contains(paths, x => x == path); } }); builder.Build(); }