Ejemplo n.º 1
0
            public void ResolveServiceAsTransientIfMarkedWithAttribute()
            {
                var handler      = new FakeHandlerWithTransientServiceBehavior();
                var handleMethod = HandleByStrategyAttribute.Default.GetHandleMethods(typeof(FakeHandlerWithTransientServiceBehavior), serviceProvider.Object).Single();

                handleMethod.Value(handler, new FakeEvent());
                handleMethod.Value(handler, new FakeEvent());

                serviceProvider.Verify(mock => mock.GetService(typeof(FakeService)), Times.Exactly(2));
            }
            public void ResolveServiceAsTransientIfMarkedWithAttribute()
            {
                var handler = new FakeHandlerWithTransientServiceBehavior();
                var handleMethod = HandleByStrategyAttribute.Default.GetHandleMethods(typeof(FakeHandlerWithTransientServiceBehavior), serviceProvider.Object).Single();

                handleMethod.Value(handler, new FakeEvent());
                handleMethod.Value(handler, new FakeEvent());

                serviceProvider.Verify(mock => mock.GetService(typeof(FakeService)), Times.Exactly(2));
            }