public int Compare(object x, object y) { ICommandDecorator xDecorator = x as ICommandDecorator; ICommandDecorator yDecorator = y as ICommandDecorator; if (xDecorator == null || yDecorator == null) { return(0); } return(xDecorator.Stage.CompareTo(yDecorator.Stage)); }
public static TestMethod BuildSingleTestMethod(MethodInfo method, Test parentSuite, ParameterSet parms) { TestMethod testMethod = new TestMethod(method, parentSuite); string fullName = method.ReflectedType.FullName; if (parentSuite != null) { fullName = parentSuite.FullName; } if (CheckTestMethodSignature(testMethod, parms)) { if (parms == null) { testMethod.ApplyCommonAttributes(method); } object[] customAttributes = method.GetCustomAttributes(typeof(ICommandDecorator), inherit: true); for (int i = 0; i < customAttributes.Length; i++) { ICommandDecorator item = (ICommandDecorator)customAttributes[i]; testMethod.CustomDecorators.Add(item); } ExpectedExceptionAttribute[] array = (ExpectedExceptionAttribute[])method.GetCustomAttributes(typeof(ExpectedExceptionAttribute), inherit: false); if (array.Length > 0) { ExpectedExceptionAttribute expectedExceptionAttribute = array[0]; string handler = expectedExceptionAttribute.Handler; if (handler != null && GetExceptionHandler(testMethod.FixtureType, handler) == null) { MarkAsNotRunnable(testMethod, $"The specified exception handler {handler} was not found"); } testMethod.CustomDecorators.Add(new ExpectedExceptionDecorator(expectedExceptionAttribute.ExceptionData)); } } if (parms != null) { method = testMethod.Method; if (parms.TestName != null) { testMethod.Name = parms.TestName; testMethod.FullName = fullName + "." + parms.TestName; } else if (parms.OriginalArguments != null) { string text = (testMethod.Name = MethodHelper.GetDisplayName(method, parms.OriginalArguments)); testMethod.FullName = fullName + "." + text; } parms.ApplyToTest(testMethod); } return(testMethod); }
public OperationDecorator(IOperationHandler <TOperation> handler, ICommandDecorator <TOperation> commandDecorator) { if (commandDecorator == null) { throw new ArgumentNullException(nameof(commandDecorator)); } if (handler == null) { throw new ArgumentNullException(nameof(handler)); } _handler = handler; _commandDecorator = commandDecorator; }
private int CommandDecoratorComparison(ICommandDecorator x, ICommandDecorator y) { return(x.Stage.CompareTo(y.Stage)); }
public static ICommandBehavior Apply(this ICommandBehavior command, ICommandDecorator decorator) { return(new DecoratedCommandBehavior(command, decorator)); }
public DecoratedCommandBehavior(ICommandBehavior command, ICommandDecorator decorator) { _command = command; _decorator = decorator; }