public void MultiParameteredPathRouteTest() { var controller = new MultiParameteredPathTestController(); var list = RouteHelper.GetActions(controller.GetType()); string id1 = "mikumiku"; int id2 = 3939; float id3 = 39.3939f; var invoker = list.First(); var parameters = invoker.MakeParamters($"get/api/MultiParameteredPath/{id1}/{id2}/{id3}", null, null); Assert.Null(controller._id1); Assert.Equal(0, controller._id2); Assert.Equal(0, controller._id3); invoker.Invoker.InvokeReturn(controller, parameters); Assert.Equal(id1, controller._id1); Assert.Equal(id2, controller._id2); Assert.Equal(id3, controller._id3); }
public void CustomAttributeCacheTest() { var value = 3939; var action = RouteHelper.GetActions(typeof(TestController)).First(); var attr = action.GetCustomAttribute <CustomAttribute>(); Assert.Equal(0, attr.Value); attr.Value = value; Assert.Equal(value, action.GetCustomAttribute <CustomAttribute>().Value); }
public InvokeAllTypeTests() { AllInvokeController.LastInvoked = null; var _controller = new AllInvokeController(); var _list = RouteHelper.GetActions(_controller.GetType()); Assert.Equal(8, _list.Count); ServiceCollection services = new ServiceCollection(); router.Regist(services, _list); this._provider = services.BuildServiceProvider(); }
public RouterFixture() { ServiceCollection services = new ServiceCollection(); var controllers = new Type[] { typeof(MultiParameteredPathTestController) }; foreach (var controllerType in controllers) { var actions = RouteHelper.GetActions(controllerType); _router.Regist(services, actions); } _provider = services.BuildServiceProvider(); }
public void CustomAttributeNotExistTest() { var action = RouteHelper.GetActions(typeof(TestController)).Last(); Assert.Null(action.GetCustomAttribute <CustomAttribute>()); }
public void Test() { var action = RouteHelper.GetActions(typeof(TestController)).First(); }