.net core - How to unit test ActionFilterAttribute -
i'm looking test actionfilterattribute in .net core 2.0 api project , wondering best way go it. note, i'm not trying test through controller action, merely test actionfilterattribute itself. how might go testing this: public class validatemodelattribute : actionfilterattribute { public override void onactionexecuting(actionexecutingcontext context) { if (!context.modelstate.isvalid) { context.result = new badrequestobjectresult(context.modelstate); } } } create instance of context pass filter , assert expected behavior for example [testclass] public class validatemodelattributetest { [testmethod] public void invalid_modelstate_should_return_badrequestobjectresult() { //arrange var httpcontext = new defaulthttpcontext(); var context = new actionexecutingcontext( new actioncontext { httpcontext = httpc...