public void Test_OnActionExecuted() { var att = new Flatwhite.WebApi.RevalidateAttribute("User"); var httpActionExecutedContext = GetHttpActionExecutedContext(); var str = ""; Global.RevalidateEvent += s => { str = s; }; att.OnActionExecuted(httpActionExecutedContext); Assert.AreEqual("User", str); }
public void Test_OnActionExecuted_should_do_nothing_if_Response_is_failed() { var att = new Flatwhite.WebApi.RevalidateAttribute("User"); var httpActionExecutedContext = GetHttpActionExecutedContext(); httpActionExecutedContext.Response = new HttpResponseMessage(HttpStatusCode.NotFound); var str = ""; Global.RevalidateEvent += s => { str = s; }; att.OnActionExecuted(httpActionExecutedContext); Assert.AreEqual("", str); }