public IControllerActionReference CreateActionReference(ICodeGeneratorServices services, Type controllerType, string areaName, string controllerName, string actionName, MethodSignature signature, params ActionArgument[] arguments) { return new ControllerActionReference(services, controllerType, areaName, controllerName, actionName, signature, arguments); }
public void Equals_SameEverythingButType_NotEqual() { var ms1 = new MethodSignature(GetType(), "Method", new[] {typeof (string)}); var ms2 = new MethodSignature(typeof (string), "Method", new[] {typeof (string)}); Assert.IsFalse(ms1.Equals(ms2)); Assert.AreNotEqual(ms1.GetHashCode(), ms2.GetHashCode()); Assert.AreNotEqual(ms1.ToString(), ms2.ToString()); }
public void Equals_DifferentNameSameTypes_NotEqual() { var ms1 = new MethodSignature(GetType(), "Method1", new[] {typeof (string)}); var ms2 = new MethodSignature(GetType(), "Method2", new[] {typeof (string)}); Assert.IsFalse(ms1.Equals(ms2)); Assert.AreNotEqual(ms1.GetHashCode(), ms2.GetHashCode()); Assert.AreNotEqual(ms1.ToString(), ms2.ToString()); }
public void Equals_SameNameSameTypes_Works() { var ms1 = new MethodSignature(GetType(), "Method", new[] {typeof (string)}); var ms2 = new MethodSignature(GetType(), "Method", new[] {typeof (string)}); Assert.IsTrue(ms1.Equals(ms2)); Assert.AreEqual(ms1.GetHashCode(), ms2.GetHashCode()); Assert.AreEqual(ms1.ToString(), ms2.ToString()); }
public void Equals_SameNameDifferentNumberOfTypes_NotEqual() { MethodSignature ms1 = new MethodSignature(GetType(), "Method", new Type[] { typeof(string) }); MethodSignature ms2 = new MethodSignature(GetType(), "Method", new Type[] { typeof(string), typeof(string) }); Assert.IsFalse(ms1.Equals(ms2)); Assert.AreNotEqual(ms1.GetHashCode(), ms2.GetHashCode()); Assert.AreNotEqual(ms1.ToString(), ms2.ToString()); }
public MethodInformation ResolveMethodInformation(MethodSignature signature ) { MethodInformation returned; _lock.AcquireReaderLock(-1); if (_methods.ContainsKey(signature.Type)) { if (_methods[signature.Type].ContainsKey(signature)) { returned = _methods[signature.Type][signature]; _lock.ReleaseLock(); return returned; } } _lock.UpgradeToWriterLock(-1); if (!_methods.ContainsKey(signature.Type)) { _methods[signature.Type] = new Dictionary<MethodSignature, MethodInformation>(); } MethodInfo method = signature.Type.GetMethod(signature.Name, BindingFlags.Public | BindingFlags.Instance, null, signature.Types, new ParameterModifier[0]); if (method == null) { _lock.ReleaseLock(); throw new MissingMethodException(String.Format("Missing method: '{0}' on '{1}'", signature.Name, signature.Type.FullName)); } returned = new MethodInformation(method, GetParameters(method), method.GetCustomAttributes(true)); _methods[signature.Type][signature] = returned; _lock.ReleaseLock(); return returned; }
public ControllerActionReference(ICodeGeneratorServices services, Type controllerType, string areaName, string controllerName, string actionName, MethodSignature signature, params ActionArgument[] arguments) : base(services, controllerType, areaName, controllerName, actionName) { _arguments = arguments; _signature = signature; }
public bool ConvertArgument(MethodSignature signature, ActionArgument argument, IDictionary parameters) { parameters.Add(argument.Name, argument.Value); return true; }