コード例 #1
0
        public void GetItemExpandTypeRouting()
        {
            var result = ActionSelectorValidator.GetTargetAction(new HttpMethod("GET"), $"{nameof(MockContext.Items)}(1)?$expand=Type");

            Assert.AreEqual("Get", result.ActionName);
            Assert.AreEqual($"{nameof(MockContext.Items)}", result.ControllerDescriptor.ControllerName);
            Assert.IsTrue(result.ReturnType == typeof(IQueryable <Item>));
        }
コード例 #2
0
        public void GetManyItemsByNavigationProperty()
        {
            var result = ActionSelectorValidator.GetTargetAction(new HttpMethod("GET"), $"{nameof(MockContext.Types)}(1)/Items");

            Assert.AreEqual("GetRelatedEntities", result.ActionName);
            Assert.AreEqual($"{nameof(MockContext.Types)}", result.ControllerDescriptor.ControllerName);
            Assert.IsTrue(result.ReturnType == typeof(IQueryable <Item>));
        }
コード例 #3
0
        public void GetTypeByNavigationProperty()
        {
            var result = ActionSelectorValidator.GetTargetAction(new HttpMethod("GET"), $"{nameof(MockContext.Items)}(1)/Type");

            Assert.AreEqual("GetRelatedEntity", result.ActionName);
            Assert.AreEqual($"{nameof(MockContext.Items)}", result.ControllerDescriptor.ControllerName);
            Assert.IsTrue(result.ReturnType == typeof(SingleResult <ItemType>));
        }
コード例 #4
0
        public void GetAllTypesRoute()
        {
            var result = ActionSelectorValidator.GetTargetAction(new HttpMethod("GET"), nameof(MockContext.Types));

            Assert.AreEqual("Get", result.ActionName);
            Assert.AreEqual($"{nameof(MockContext.Types)}", result.ControllerDescriptor.ControllerName);
            Assert.IsTrue(result.ReturnType == typeof(IQueryable <ItemType>));
        }