public void select_version_should_return_default_api_version()
        {
            // arrange
            var options  = new ApiVersioningOptions();
            var selector = new DefaultApiVersionSelector(options);
            var request  = new HttpRequestMessage();
            var model    = ApiVersionModel.Default;
            var version  = new ApiVersion(1, 0);

            // act
            var selectedVersion = selector.SelectVersion(request, model);

            // assert
            selectedVersion.Should().Be(version);
        }
Ejemplo n.º 2
0
        public void select_version_should_return_max_api_version(IEnumerable <ApiVersion> supportedVersions, IEnumerable <ApiVersion> deprecatedVersions, ApiVersion expectedVersion)
        {
            // arrange
            var options = new ApiVersioningOptions()
            {
                DefaultApiVersion = new ApiVersion(42, 0)
            };
            var selector = new CurrentImplementationApiVersionSelector(options);
            var request  = new HttpRequestMessage();
            var model    = new ApiVersionModel(supportedVersions, deprecatedVersions);

            // act
            var selectedVersion = selector.SelectVersion(request, model);

            // assert
            selectedVersion.Should().Be(expectedVersion);
        }