Exemplo n.º 1
0
        public void testLaunchSequence()
        {
            var lo = new LocalOperations("m1", lf, appInitializedDetectorFactory );

            lo.SelectPlan( PlanRepo.plans["p1"] );

            // start the plan
            lo.StartPlan();

            var t = 0.0;

            Assert.AreEqual( 0, lf.appsLaunched.Count, "nothing started without tick" );

            lo.tick( t );

            Assert.AreEqual( "m1.b", getOrder(lf.appsLaunched), "'b' started as first app" );

            t += 1.0;
            lo.tick( t );

            Assert.AreEqual( "m1.b", getOrder(lf.appsLaunched), "'a' waiting, not yet starting (separ. interval of b is 2.0)" );

            t += 1.0;
            lo.tick( t );

            Assert.AreEqual( "m1.b,m1.a", getOrder(lf.appsLaunched), "'a' started" );

            t += 1.0;
            lo.tick( t );

            Assert.AreEqual( "m1.b,m1.a,m1.c", getOrder(lf.appsLaunched), "'c' started" );

            t += 1.0;
            lo.tick( t );

            Assert.AreEqual( "m1.b,m1.a,m1.c,m1.d", getOrder(lf.appsLaunched), "'d' started as last app" );

            Assert.AreEqual( "m1.a,m1.b,m1.c,m1.d", getAppsWithMatchingState(lo, st => st.Running ), "all aps running" );
        }
Exemplo n.º 2
0
        public void testStopPlan()
        {
            var lo = new LocalOperations("m1", lf, appInitializedDetectorFactory );

            var plan =  PlanRepo.plans["p1"];
            lo.SelectPlan( plan );
            lo.StartPlan();
            for(int i=0; i < 10; i++ ) lo.tick(i); // give enought ticks to start all
            Assert.AreEqual( "m1.a,m1.b,m1.c,m1.d", getAppsWithMatchingState(lo, st => st.Running ), "all aps running after Start()" );

            lo.KillPlan();
            lo.tick(20.0);
            Assert.AreEqual( "", getAppsWithMatchingState(lo, st => st.Running ), "no app running after Stop()" );
        }