コード例 #1
0
        public void PerformConditionalAsyncAction_WithValidGates_ShouldPerformTheFirstAvailableGate()
        {
            VerifyAsync(async() =>
            {
                int count = 0;
                IGateContext gateContext = new GateContext(new UnitTestGatedRequest(), new BasicMachineInformation(), new DefaultExperimentContext());
                await gateContext.PerformConditionalAction(
                    () => false,
                    new GatedAsyncAction(Gates.GetGate("ActiveGate1"),
                                         async() => { count++; await Task.Delay(10); }),
                    new GatedAsyncAction(Gates.GetGate("ActiveGate2"),
                                         async() => { count++; await Task.Delay(10); }));

                Assert.Equal(count, 0);
            });
        }
コード例 #2
0
        public void PerformConditionalAction_WithValidGates_ShouldPerformTheFirstAvailableGate()
        {
            int          count       = 0;
            IGateContext gateContext = new GateContext(new UnitTestGatedRequest(), new BasicMachineInformation(), new DefaultExperimentContext());

            gateContext.PerformConditionalAction(
                () =>
            {
                return(false);
            },
                new GatedAction(Gates.GetGate("ActiveGate1"), () => { count++; }),
                new GatedAction(Gates.GetGate("ActiveGate2"), () => { count++; })
                );

            Assert.Equal(count, 0);
        }