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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }