예제 #1
0
        public void UnitTestOptionsShouldWork()
        {
            ODataQueryOptionsController controller = new ODataQueryOptionsController();

            ODataQueryContext  context = new ODataQueryContext(GetEdmModel(), typeof(ODataQueryOptions_Todo));
            HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/?$orderby=Name desc");
            ODataQueryOptions <ODataQueryOptions_Todo> options = new ODataQueryOptions <ODataQueryOptions_Todo>(context, request);
            var result = controller.OptionsOnString(options);

            Assert.Equal("Test99", result);
        }
예제 #2
0
        public void UnitTestOptionsShouldWork()
        {
            ODataQueryOptionsController controller = new ODataQueryOptionsController();

            ODataQueryContext  context       = new ODataQueryContext(GetEdmModel(), typeof(ODataQueryOptions_Todo), path: null);
            HttpRequestMessage request       = new HttpRequestMessage(HttpMethod.Get, "http://localhost/?$orderby=Name desc");
            HttpConfiguration  configuration = new HttpConfiguration();

            configuration.EnableDependencyInjection();
            request.SetConfiguration(configuration);
            ODataQueryOptions <ODataQueryOptions_Todo> options = new ODataQueryOptions <ODataQueryOptions_Todo>(context, request);
            var result = controller.OptionsOnString(options);

            Assert.Equal("Test99", result);
        }