Ejemplo n.º 1
0
        protected override void TestSetup()
        {
            firstEventListener  = new eventListenerForMultiple();
            secondEventListener = new eventListenerForMultiple();
            thirdEventListener  = new eventListenerForMultiple();
            eventListenerForMultiple.FirstCallOnDelete          = true;
            eventListenerForMultiple.FirstCallOnGetSuccessful   = true;
            eventListenerForMultiple.FirstCallOnPut             = true;
            eventListenerForMultiple.FirstCallOnGetUnsuccessful = true;

            CacheBuilder
            .For <ReturningRandomNumbers>()
            .CacheMethod(c => c.CachedNumber())
            .As <IReturningRandomNumbers>()
            .AddEventListener(firstEventListener)
            .AddEventListener(secondEventListener)
            .AddEventListener(thirdEventListener);

            var factory = CacheBuilder.BuildFactory();
            var comp    = factory.Create <IReturningRandomNumbers>();

            comp.CachedNumber();
            comp.CachedNumber();
            ((ICachingComponent)comp).Invalidate();
        }
Ejemplo n.º 2
0
		protected override void TestSetup()
		{
			firstEventListener = new eventListenerForMultiple();
			secondEventListener = new eventListenerForMultiple();
			thirdEventListener = new eventListenerForMultiple();
			eventListenerForMultiple.FirstCallOnDelete = true;
			eventListenerForMultiple.FirstCallOnGetSuccessful = true;
			eventListenerForMultiple.FirstCallOnPut = true;

			CacheBuilder
				.For<ReturningRandomNumbers>()
					.CacheMethod(c => c.CachedNumber())
					.As<IReturningRandomNumbers>()
				.AddEventListener(firstEventListener)
				.AddEventListener(secondEventListener)
				.AddEventListener(thirdEventListener);

			var factory = CacheBuilder.BuildFactory();
			var comp = factory.Create<IReturningRandomNumbers>();
			comp.CachedNumber();
			comp.CachedNumber();
			((ICachingComponent)comp).Invalidate();
		}