Beispiel #1
0
        public void should_map_controller_should_return_expected_result_for_controller_version(int majorVersion, bool expected)
        {
            // arrange
            var model      = new ODataModelBuilder().GetEdmModel();
            var controller = new HttpControllerDescriptor(new HttpConfiguration(), string.Empty, typeof(ControllerV1));
            var convention = new VersionedAttributeRoutingConvention(model, new HttpControllerDescriptor[0]);

            model.SetAnnotationValue(model, new ApiVersion(majorVersion, 0));

            // act
            var result = convention.ShouldMapController(controller);

            // assert
            result.Should().Be(expected);
        }
Beispiel #2
0
        public void should_map_controller_should_return_true_for_versionX2Dneutral_controller()
        {
            // arrange
            var model      = new ODataModelBuilder().GetEdmModel();
            var controller = new HttpControllerDescriptor(new HttpConfiguration(), string.Empty, typeof(NeutralController));
            var convention = new VersionedAttributeRoutingConvention(model, new HttpControllerDescriptor[0]);

            model.SetAnnotationValue(model, new ApiVersion(1, 0));

            // act
            var result = convention.ShouldMapController(controller);

            // assert
            result.Should().BeTrue();
        }