예제 #1
0
        public void Should_do_nothing_if_method_is_not_async()
        {
            // Arrange
            // Arrange
            var filter = new DefaultMethodFilter();

            // Action
            filter.CheckValid(new DynamicMethod("", typeof(int), null, true), null, false);
        }
예제 #2
0
        public void Should_throw_exception_if_method_is_async_and_has_return_type()
        {
            MethodInfo info = new DynamicMethod("", typeof(int), null, true);

            // Arrange
            var filter = new DefaultMethodFilter();

            // Action
            filter.CheckValid(info, null, true);
        }
예제 #3
0
        public void Should_return_true_if_attributes_contain_AsyncAttribute()
        {
            // Arrange
            var filter = new DefaultMethodFilter();

            // Action
            var result = filter.IsAsync(null, new Attribute[] {new AsyncAttribute()});

            // Assert
            Assert.IsTrue(result);
        }
예제 #4
0
        public void Should_return_false_if_attributes_not_contain_AsyncAttribute()
        {
            // Arrange
            var filter = new DefaultMethodFilter();

            // Action
            var result = filter.IsAsync(null, new Attribute[0]);

            // Assert
            Assert.IsFalse(result);
        }
예제 #5
0
        public void Should_not_throw_exception_if_method_is_async_and_has_ref_param()
        {
            var type = typeof(ISomeService);
            var method = type.GetMethod("Save");

            // Arrange
            var filter = new DefaultMethodFilter();

            // Action
            filter.CheckValid(method, null, true);
        }
예제 #6
0
        public void Should_return_true_if_attributes_are_null()
        {
            // Arrange
            var filter = new DefaultMethodFilter();

            // Action
            var result = filter.IsAsync(null, null);

            // Assert
            Assert.IsFalse(result);

        }
예제 #7
0
        public void Should_throw_exception_if_method_is_property_accessor()
        {
            var type = typeof(ISomeService);

            var method = type.GetMethod("get_Message");

            // Arrange
            var filter = new DefaultMethodFilter();

            // Action
            filter.CheckValid(method, null, true);
        }
예제 #8
0
        public void Should_throw_exception_if_method_has_delegate_param()
        {
            var type = typeof(ISomeService);
            
            var method = type.GetMethod("add_Event");

            // Arrange
            var filter = new DefaultMethodFilter();

            // Action
            filter.CheckValid(method, null, true);
        }
예제 #9
0
        public void Should_throw_exception_if_method_is_async_and_has_out_param()
        {
            DefaultMethodFilter.CheckedMethodCaches.Clear();
            var type = typeof (ISomeService);
            var method = type.GetMethod("TryParse");

            // Arrange
            var filter = new DefaultMethodFilter();

            // Action
            filter.CheckValid(method, null, true);
        }