public async Task Test_OnActionExecutedAsync()
        {
            var att = new Flatwhite.WebApi.RevalidateAttribute("User");
            var httpActionExecutedContext = GetHttpActionExecutedContext();

            var str = "";
            Global.RevalidateEvent += s => { str = s; };
            await att.OnActionExecutedAsync(httpActionExecutedContext, CancellationToken.None);
            Assert.AreEqual("User", str);
        }
        public async Task Test_OnActionExecutedAsync_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; };
            await att.OnActionExecutedAsync(httpActionExecutedContext, CancellationToken.None);
            Assert.AreEqual("", str);
        }
Exemple #3
0
        public async Task Test_OnActionExecutedAsync()
        {
            var att = new Flatwhite.WebApi.RevalidateAttribute("User");
            var httpActionExecutedContext = GetHttpActionExecutedContext();

            var str = "";

            Global.RevalidateEvent += s => { str = s; };
            await att.OnActionExecutedAsync(httpActionExecutedContext, CancellationToken.None);

            Assert.AreEqual("User", str);
        }
Exemple #4
0
        public async Task Test_OnActionExecutedAsync_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; };
            await att.OnActionExecutedAsync(httpActionExecutedContext, CancellationToken.None);

            Assert.AreEqual("", str);
        }