public void select_action_should_return_true_for_versionX2Dneutral_controller() { // arrange var routeContext = NewRouteContext("http://localhost/NeutralTests/1", typeof(VersionNeutralController)); var serviceProvider = routeContext.HttpContext.RequestServices; var convention = new VersionedAttributeRoutingConvention("odata", serviceProvider); // act var result = convention.SelectAction(routeContext); // assert result.Single().ActionName.Should().Be("Get"); }
public void select_action_should_return_expected_result_for_controller_version(int majorVersion, string expected) { // arrange var apiVersion = majorVersion + ".0"; var routeContext = NewRouteContext($"http://localhost/Tests(1)?api-version={apiVersion}", typeof(TestsController), apiVersion); var serviceProvider = routeContext.HttpContext.RequestServices; var convention = new VersionedAttributeRoutingConvention("odata", serviceProvider); // act var actionName = convention.SelectAction(routeContext)?.SingleOrDefault()?.ActionName; // assert actionName.Should().Be(expected); }