示例#1
0
        public async Task OnMethodExecutedAsync_should_do_nothing_if_RevalidateEvent_doesnot_have_subscriptions()
        {
            var att = new RevalidateAttribute
            {
                KeyFormats = { "user", "book" }
            };
            string abc = "";

            await att.OnMethodExecutedAsync(_methodExecutedContext);

            Assert.IsEmpty(abc);
        }
        public async Task OnMethodExecutedAsync_should_do_nothing_if_RevalidateEvent_doesnot_have_subscriptions()
        {
            var att = new RevalidateAttribute
            {
                KeyFormats = { "user", "book" }
            };
            string abc = "";
            
            await att.OnMethodExecutedAsync(_methodExecutedContext);

            Assert.IsEmpty(abc);
        }
示例#3
0
        public async Task OnMethodExecutedAsync_should_call_RevalidateCachesAsync_on_global()
        {
            var att = new RevalidateAttribute
            {
                KeyFormats = { "user", "book" }
            };
            string abc = "";

            Global.RevalidateEvent += x =>
            {
                abc += x;
            };
            await att.OnMethodExecutedAsync(_methodExecutedContext);

            Assert.AreEqual(8, abc.Length);
        }
        public async Task OnMethodExecutedAsync_should_call_RevalidateCachesAsync_on_global()
        {
            var att = new RevalidateAttribute
            {
                KeyFormats = { "user", "book"}
            };
            string abc = "";
            Global.RevalidateEvent += x =>
            {
                abc += x;
            };
            await att.OnMethodExecutedAsync(_methodExecutedContext);

            Assert.AreEqual(8, abc.Length);

        }