Exemple #1
0
        public void PerformEachAction_WithUnscopedModeAndWithMultipleActiveAndInactiveGates_ShouldPerformUnscopedActionsForAllActiveGates()
        {
            int          count       = 0;
            IGateContext gateContext = new GateContext(new UnitTestGatedRequest(), new BasicMachineInformation(), new DefaultExperimentContext());

            gateContext.PerformEachAction(GatedCode.Modes.None,
                                          new GatedAction(Gates.GetGate("InactiveGate1"),
                                                          () => { Assert.False(true, "Should not perform action for inactive gate."); }),
                                          new GatedAction(Gates.GetGate("ActiveGate1"),
                                                          () => { count++; }),
                                          new GatedAction(Gates.GetGate("ActiveGate2"),
                                                          () => { count++; }),
                                          new GatedAction(Gates.GetGate("InactiveGate2"),
                                                          () => { Assert.False(true, "Should not perform action for inactive gate."); }),
                                          new GatedAction(
                                              () => { count++; }));

            Assert.Equal(count, 3);
            Assert.False(gateContext.ActivatedGates.Contains(Gates.GetGate("ActiveGate1")), "Expected gate1 not to be reported as activated");
            Assert.False(gateContext.ActivatedGates.Contains(Gates.GetGate("ActiveGate2")), "Expected gate2 not to be reported as activated");
        }