Esempio n. 1
0
        public void Should_Create_Multiple_Plugins( )
        {
            Trigger testTrigger = new Trigger( 1, DateTime.Now, -1 );

            testTrigger.AddPlugin( new Example( 1, 1, "Example plugin" ) );
            testTrigger.AddPlugin( new Ping( 1, 1, "127.0.0.1" ) );
            testTrigger.AddPlugin( new Example( 1, 1, "Example plugin2" ) );
            testTrigger.AddPlugin( new Ping( 1, 1, "127.0.0.1" ) );

            Assert.AreEqual( 4, testTrigger.GetAllPlugins( ).Count( ) );
        }
Esempio n. 2
0
        public void Should_Create_One_Plugin( )
        {
            Trigger testTrigger = new Trigger( 1, DateTime.Now, -1 );

            testTrigger.AddPlugin(new Example(1, 1, "Example plugin"));

            Assert.IsNotNull( testTrigger.GetPlugin( 0 ) );
        }
Esempio n. 3
0
        public void Should_Remove_Plugin( )
        {
            Trigger testTrigger = new Trigger( 1, DateTime.Now, 10 );

            testTrigger.AddPlugin( new Example( 1, 1, "Example plugin" ) );
            testTrigger.RemovePlugin( 0 );

            Assert.IsEmpty( testTrigger.GetAllPlugins( ) );
        }
Esempio n. 4
0
        public void Should_Run_Multiple_Plugins( )
        {
            Trigger testTrigger = new Trigger( 1, DateTime.Now, -1 );

            testTrigger.AddPlugin( new Example( 1, 1, "Example plugin" ) );
            testTrigger.AddPlugin( new Ping( 1, 1, "127.0.0.1" ) );
            testTrigger.AddPlugin( new Example( 1, 1, "Example plugin2" ) );
            testTrigger.AddPlugin( new Ping( 1, 1, "127.0.0.1" ) );

            bool fd = false;
            testTrigger.TriggerActivatedEvent +=
                ( sender, args ) => fd = 4 == args.GetResults( ).Count( );

            testTrigger.Start( );
            Timing.WaitUntil( ( ) => fd, 10000 );

            Assert.IsTrue( fd );
        }
Esempio n. 5
0
        public void Should_Run_One_Plugin( )
        {
            Trigger testTrigger = new Trigger( 1, DateTime.Now, -1 );

            testTrigger.AddPlugin( new Example( 1, 1, "Example plugin" ) );

            bool fd = false;

            testTrigger.TriggerActivatedEvent +=
                ( sender, args ) => fd = "Example plugin" == ( ( ExampleResult )args.GetResults( ).ElementAt( 0 ) ).ExampleText;

            testTrigger.Start( );
            Timing.WaitUntil( ( ) => fd, 10000 );

            Assert.IsTrue( fd );
        }