Junior.Route.AutoRouting.ParameterMappers.HttpApplicationStateBaseMapper.MapAsync C# (CSharp) Method

MapAsync() public method

public MapAsync ( System.Web.HttpContextBase context, Type type, MethodInfo method, ParameterInfo parameter ) : Task
context System.Web.HttpContextBase
type System.Type
method System.Reflection.MethodInfo
parameter System.Reflection.ParameterInfo
return Task
        public Task<MapResult> MapAsync(HttpContextBase context, Type type, MethodInfo method, ParameterInfo parameter)
        {
            context.ThrowIfNull("context");
            type.ThrowIfNull("type");
            method.ThrowIfNull("method");
            parameter.ThrowIfNull("parameter");

            return MapResult.ValueMapped(context.Application).AsCompletedTask();
        }

Usage Example

			public void SetUp()
			{
				_application = MockRepository.GenerateMock<HttpApplicationStateBase>();
				_context = MockRepository.GenerateMock<HttpContextBase>();
				_context.Stub(arg => arg.Application).Return(_application);
				_mapper = new HttpApplicationStateBaseMapper();

				Type type = typeof(When_mapping_parameter);
				MethodInfo methodInfo = type.GetMethod("Method", BindingFlags.NonPublic | BindingFlags.Instance);
				ParameterInfo parameterInfo = methodInfo.GetParameters()[0];

				_result = _mapper.MapAsync(_context, type, methodInfo, parameterInfo).Result;
			}
HttpApplicationStateBaseMapper