Esempio n. 1
0
        public ODataRoutingTest()
        {
            var model = ODataRoutingModel.GetModel();

            var controllers = new[]
            {
                typeof(DateTimeOffsetKeyCustomersController),
                typeof(MetadataController),
                typeof(RoutingCustomersController),
                typeof(ProductsController),
                typeof(EnumCustomersController),
                typeof(DestinationsController),
            };

            // Separate clients and servers so routes are not ambiguous.
            var nullPrefixServer = TestServerFactory.Create(controllers, (config) =>
            {
                config.MapODataServiceRoute("NullPrefixRoute", null, model);
            });

            _nullPrefixClient = TestServerFactory.CreateClient(nullPrefixServer);

            // FixedPrefixRoute has both a non-empty virtual path root and a fixed route prefix.
            var fixedPrefixServer = TestServerFactory.Create(controllers, (config) =>
            {
                config.MapODataServiceRoute("FixedPrefixRoute", "MyRoot/odata", model);
            });

            _fixedPrefixClient = TestServerFactory.CreateClient(fixedPrefixServer);

            var parameterizedPrefixServer = TestServerFactory.Create(controllers, (config) =>
            {
                config.MapODataServiceRoute("ParameterizedPrefixRoute", "{a}", model);
            });

            _parameterizedPrefixClient = TestServerFactory.CreateClient(parameterizedPrefixServer);
        }
Esempio n. 2
0
 public ODataPathSegmentTranslatorTest()
 {
     _model      = ODataRoutingModel.GetModel();
     _translator = new ODataPathSegmentTranslator(_model, new Dictionary <string, SingleValueNode>());
 }