Beispiel #1
0
        public async Task Cache_Aspect_Caches_Method_Result()
        {
            var target   = new TestCalss();
            var expected = target.Calculate(10, "test");
            await Task.Delay(10);

            var result = target.Calculate(10, "test");
            await Task.Delay(10);

            var result2 = target.Calculate(101, "test1");

            Assert.Equal(expected, result);
            Assert.NotEqual(result2, result);
        }
Beispiel #2
0
        public async Task Cache_Aspect_Distinct_Instances()
        {
            var target  = new TestCalss();
            var target2 = new TestCalss();
            var result1 = target.Calculate(20, "test");
            await Task.Delay(10);

            var result2 = target2.Calculate(20, "test");

            Assert.NotEqual(result1, result2);
        }