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_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 GatedCode_UsingGateWithReleasePlanHavingNoApplicableReleaseGates_NoApplicableReleaseGateReturnedUsingGatesProperty() { GateDataSet gateDataSet = LoadGateDataSet(GateXmlWithReleaseGates); // Gates property intialized with GatesNone object. GatedCode gatedCode = new GatedCode(gateDataSet.GetGate("MyProduct.Test.ReleasePlan")); UnitTestGateContext gateContext = new UnitTestGateContext { AlwaysReturnApplicable = false, ApplicableGates = new List <string>() { "MyProduct.Test.ReleasePlan", } }; Assert.False(gatedCode.IsBaselineCode, "Shouldn't be a baseline code as its gated."); Assert.False(gatedCode.Gates.IsApplicable(gateContext, out IGate[] gates), "Returns false as no release gate applicable"); Assert.Null(gates); }
public void GatedCode_UsingGateWithReleasePlanHavingApplicableReleaseGates_FirstApplicableReleaseGateReturnedUsingGatesProperty() { GateDataSet gateDataSet = LoadGateDataSet(GateXmlWithReleaseGates); // Gates property intialized with GatesAny object. GatedCode gatedCode = new GatedCode(gateDataSet.GetGate("MyProduct.Test.ReleasePlan")); UnitTestGateContext gateContext = new UnitTestGateContext { AlwaysReturnApplicable = false, ApplicableGates = new List <string>() { "MyProduct.Test.ReleasePlan", "MyProduct.WebSite.Feature.ReleasePlan.Integration" } }; Assert.False(gatedCode.IsBaselineCode, "Shouldn't be a baseline code as its gated."); Assert.True(gatedCode.Gates.IsApplicable(gateContext, out IGate[] gates), "Returns true with first applicable release gate."); Assert.Equal("MyProduct.WebSite.Feature.ReleasePlan.Integration", gates.First().FullyQualifiedName); }