Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public void AcceptableByFilter_ShouldNotAcceptMethod_WhenMethodHasNoExecuteMethodAttribute()
        {
            TestAutoProcessor processor = new TestAutoProcessor();

            processor.AcceptableByFilter(processor.GetType().GetMethod(nameof(TestAutoProcessor.EmptyMethodNotForExecution)))
            .Should().BeFalse();
        }
Exemplo n.º 3
0
        public void AcceptableByFilter_ShouldAcceptMethod_WhenMethodHasExecuteMethodAttribute()
        {
            TestAutoProcessor processor = new TestAutoProcessor();

            processor.AcceptableByFilter(processor.GetType().GetMethod(nameof(TestAutoProcessor.EmptyMethod)))
            .Should().BeTrue();
        }
Exemplo n.º 4
0
        public void GetMethodsToExecute_ShouldReturnEmptyCollection_WhenGetMethodBindingAttributesReturnsNull()
        {
            var mock = new TestAutoProcessor();

            mock.GetFlags = () => null;

            mock.GetMethodsToExecute().Should().BeEmpty();
        }
Exemplo n.º 5
0
        public void GetOrderOfExecution_ShouldReturnNotThrowExceptionAndReturnZero_WhenMethodDoesntHaveAttribute()
        {
            TestAutoProcessor processor = new TestAutoProcessor();
            var method = processor.GetType().GetMethod(nameof(TestAutoProcessor.EmptyMethodNotForExecution));

            processor.GetOrderOfExecution(method).Should().Be(default);
Exemplo n.º 6
0
        public void AcceptableByFilter_ShouldNotThrowExceptionAndBeNotAcceptable_WhenMethodIsNull()
        {
            TestAutoProcessor processor = new TestAutoProcessor();

            processor.AcceptableByFilter(null).Should().BeFalse();
        }
Exemplo n.º 7
0
        public void GetMethodsToExecute_ShouldReturnNonEmptyCollection_WhenDescendantClassContainsImplementations()
        {
            TestAutoProcessor processor = new TestAutoProcessor();

            processor.GetMethodsToExecute().Should().NotBeEmpty().And.Contain(x => x.Name == nameof(TestAutoProcessor.EmptyMethod));
        }