public void InterceptWithInstanceAndPredicate_TwoInterceptors_InterceptsTheInstanceWithBothInterceptors()
        {
            // Arrange
            var logger = new FakeLogger();

            var interceptor1 = new InterceptorThatLogsBeforeAndAfter(logger)
            {
                BeforeText = "Start1 ",
                AfterText = " Done1"
            };

            var interceptor2 = new InterceptorThatLogsBeforeAndAfter(logger)
            {
                BeforeText = "Start2 ",
                AfterText = " Done2"
            };

            var container = ContainerFactory.New();

            container.RegisterSingleton<ILogger>(logger);
            container.Register<ICommand, CommandThatLogsOnExecute>();

            container.InterceptWith(interceptor1, IsACommandPredicate);
            container.InterceptWith(interceptor2, IsACommandPredicate);

            container.RegisterInitializer<CommandThatLogsOnExecute>(c => c.ExecuteLogMessage = "Executing");

            // Act
            var command = container.GetInstance<ICommand>();

            command.Execute();

            // Assert
            Assert.AreEqual("Start2 Start1 Executing Done1 Done2", logger.Message);
        }
        public void InterceptWithInstanceAndPredicate_InterceptingInterfacesEndingWithCommand_InterceptsTheInstance()
        {
            // Arrange
            var logger = new FakeLogger();

            var singletonInterceptor = new InterceptorThatLogsBeforeAndAfter(logger)
            {
                BeforeText = "Start ",
                AfterText = " Done"
            };

            var container = ContainerFactory.New();

            container.RegisterSingleton<ILogger>(logger);
            container.Register<ICommand, CommandThatLogsOnExecute>();
            
            container.InterceptWith(singletonInterceptor, IsACommandPredicate);

            container.RegisterInitializer<CommandThatLogsOnExecute>(c => c.ExecuteLogMessage = "Executing");

            // Act
            var command = container.GetInstance<ICommand>();

            command.Execute();

            // Assert
            Assert.AreEqual("Start Executing Done", logger.Message);
        }