public void IsApplicable_ForNotApplicableReleaseGates_NoReleaseGateReturned() { IGatedRequest gateRequest = SetupGateRequest("ClientThree", "16.3.0.0", "en-us"); GateContext context = new GateContext(gateRequest, new BasicMachineInformation(), new DefaultExperimentContext()); IGate gate = Dataset.GetGate("MyProduct.Test.ReleasePlan"); GatesAny gates = new GatesAny(gate.ReleasePlan); Assert.False(gates.IsApplicable(context, out IGate[] applicableReleaseGates), "Gate should be not applicable"); Assert.Null(applicableReleaseGates); }
public void IsApplicable_WhenNoGatesSpecified_NoApplicableGatesReturned() { UnitTestGateContext context = new UnitTestGateContext { AlwaysReturnApplicable = false }; GatesAny gateCombination = new GatesAny(); Assert.False(gateCombination.IsApplicable(context, out IGate[] gates), "No gates should be applicable"); Assert.Null(gates); }
public void IsApplicable_ContainterGateIsNotApplicable_NoReleaseGateReturned() { IGatedRequest gateRequest = SetupGateRequest("ClientThree", "16.3.0.0", "en-gb"); GateContext context = new GateContext(gateRequest, new BasicMachineInformation(), new DefaultExperimentContext()); GateDataSet dataSet = LoadGateDataSet(ReleaseGateXml); IGate gate = dataSet.GetGate("MyProduct.Test.ReleasePlan"); GatesAny gates = new GatesAny(gate.ReleasePlan); Assert.False(gates.IsApplicable(context, out IGate[] applicableReleaseGates), "Gate should not be applicable"); Assert.Null(applicableReleaseGates); }
public void IsApplicable_WithOneNotApplicable_ReturnsNoApplicableGate() { Gate notApplicableGate = new Gate("notApplicable1"); UnitTestGateContext context = new UnitTestGateContext { AlwaysReturnApplicable = false }; GatesAny gateCombination = new GatesAny(notApplicableGate); Assert.False(gateCombination.IsApplicable(context, out IGate[] gates), "Get applicable gates should be false"); Assert.Null(gates); }
public void IsApplicable_ContainterGateIsApplicable_ApplicableReleaseGateReturned() { IGatedRequest gateRequest = SetupGateRequest("ClientThree", "16.3.0.0", "en-us", "PreProduction", new[] { new GatedUser { UserIdentifier = "*****@*****.**" } }); GateContext context = new GateContext(gateRequest, new BasicMachineInformation(), new DefaultExperimentContext()); GateDataSet dataSet = LoadGateDataSet(ReleaseGateXml); IGate gate = dataSet.GetGate("MyProduct.Test.ReleasePlan"); GatesAny gates = new GatesAny(gate.ReleasePlan); Assert.True(gates.IsApplicable(context, out IGate[] applicableReleaseGates), "Gate should be applicable"); Assert.NotNull(applicableReleaseGates); Assert.Same(applicableReleaseGates[0], gate.ReleasePlan[0]); }
public void IsApplicable_ForApplicableReleaseGate_ApplicableReleaseGateReturned() { IGatedRequest gateRequest = SetupGateRequest("ClientThree", "16.3.0.0", "en-us"); GateContext context = new GateContext(gateRequest, new BasicMachineInformation(), new DefaultExperimentContext(), null, new UnitTestGateSettings(new List<string> { "MyProduct.WebSite.Feature.ReleasePlan.Integration" })); IGate gate = Dataset.GetGate("MyProduct.Test.ReleasePlan"); GatesAny gates = new GatesAny(gate.ReleasePlan); Assert.True(gates.IsApplicable(context, out IGate[] applicableReleaseGates), "Gate should be applicable"); Assert.NotNull(applicableReleaseGates); Assert.Same(applicableReleaseGates[0], gate.ReleasePlan[0]); }
public void IsApplicable_WithOneApplicableGate_ReturnsTheApplicableGate() { Gate applicableGate = new Gate("applicable1"); UnitTestGateContext context = new UnitTestGateContext { AlwaysReturnApplicable = false }; context.ApplicableGates = new string[] { applicableGate.Name }; GatesAny gateCombination = new GatesAny(applicableGate); Assert.True(gateCombination.IsApplicable(context, out IGate[] gates), "Get applicable gates should be true"); Assert.Same(applicableGate, gates[0]); }
public void IsApplicable_WithTwoApplicableGates_ReturnsFirstApplicableGate() { Gate applicableGate1 = new Gate("applicable1"); Gate applicableGate2 = new Gate("applicable2"); UnitTestGateContext context = new UnitTestGateContext { AlwaysReturnApplicable = false }; context.ApplicableGates = new string[] { applicableGate1.Name, applicableGate2.Name }; GatesAny gateCombination = new GatesAny(applicableGate1, applicableGate2); Assert.True(gateCombination.IsApplicable(context, out IGate[] gates), "Get applicable gates should be true"); Assert.Same(applicableGate1, gates[0]); }
public void IsApplicable_WithTwoNotApplicableGates_ReturnsFailureForApplicableGates() { Gate notApplicableGate1 = new Gate("notApplicable1"); Gate notApplicableGate2 = new Gate("notApplicable2"); UnitTestGateContext context = new UnitTestGateContext { AlwaysReturnApplicable = false }; context.ApplicableGates = new string[] { }; GatesAny gateCombination = new GatesAny(notApplicableGate1, notApplicableGate2); Assert.False(gateCombination.IsApplicable(context, out IGate[] gates), "Get applicable gates should be false"); Assert.Null(gates); }