public void GetOrderOfExecution_ShouldReturnNumberFromExecuteMethodAttribute_WhenItIsSpecified() { TestAutoProcessor processor = new TestAutoProcessor(); var method = processor.GetType().GetMethod(nameof(TestAutoProcessor.EmptyMethod2)); processor.GetOrderOfExecution(method).Should().Be(method.GetAttribute <OrderAttribute>().Order); }
public void AcceptableByFilter_ShouldNotAcceptMethod_WhenMethodHasNoExecuteMethodAttribute() { TestAutoProcessor processor = new TestAutoProcessor(); processor.AcceptableByFilter(processor.GetType().GetMethod(nameof(TestAutoProcessor.EmptyMethodNotForExecution))) .Should().BeFalse(); }
public void AcceptableByFilter_ShouldAcceptMethod_WhenMethodHasExecuteMethodAttribute() { TestAutoProcessor processor = new TestAutoProcessor(); processor.AcceptableByFilter(processor.GetType().GetMethod(nameof(TestAutoProcessor.EmptyMethod))) .Should().BeTrue(); }
public void GetMethodsToExecute_ShouldReturnEmptyCollection_WhenGetMethodBindingAttributesReturnsNull() { var mock = new TestAutoProcessor(); mock.GetFlags = () => null; mock.GetMethodsToExecute().Should().BeEmpty(); }
public void GetOrderOfExecution_ShouldReturnNotThrowExceptionAndReturnZero_WhenMethodDoesntHaveAttribute() { TestAutoProcessor processor = new TestAutoProcessor(); var method = processor.GetType().GetMethod(nameof(TestAutoProcessor.EmptyMethodNotForExecution)); processor.GetOrderOfExecution(method).Should().Be(default);
public void AcceptableByFilter_ShouldNotThrowExceptionAndBeNotAcceptable_WhenMethodIsNull() { TestAutoProcessor processor = new TestAutoProcessor(); processor.AcceptableByFilter(null).Should().BeFalse(); }
public void GetMethodsToExecute_ShouldReturnNonEmptyCollection_WhenDescendantClassContainsImplementations() { TestAutoProcessor processor = new TestAutoProcessor(); processor.GetMethodsToExecute().Should().NotBeEmpty().And.Contain(x => x.Name == nameof(TestAutoProcessor.EmptyMethod)); }