public void GatedCode_IntitialzedWithNullObject_NonApplicableGatesShouldBeReturnedApplicableUsingGatesProperty() { // Gates property intialized with GatesNone object. GatedCode gatedCode = new GatedCode((IGate)null); UnitTestGateContext gateContext = new UnitTestGateContext { AlwaysReturnApplicable = false, ApplicableGates = new List <string>() { "Test.Gate1", "Test.Gate2" } }; Assert.True(gatedCode.Gates.IsApplicable(gateContext, out IGate[] gates), "Returns true as no gate was applicable."); Assert.Null(gates); }
public void GatedCode_UsingGateWithoutReleasePlan_NonApplicableGateReturnedNonApplicableUsingGatesProperty() { // Gates property intialized with GatesAny object. GatedCode gatedCode = new GatedCode(new Gate("Test.Gate1")); UnitTestGateContext gateContext = new UnitTestGateContext { AlwaysReturnApplicable = false, ApplicableGates = new List <string>() { "Test.Gate2", "Test.Gate3" } }; 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 gate was applicable."); Assert.Null(gates); }
public void GatedCode_UsingGateWithoutReleasePlan_ApplicableGateReturnedApplicableUsingGatesProperty() { // Gates property intialized with GatesAny object. GatedCode gatedCode = new GatedCode(new Gate("Test.Gate1")); UnitTestGateContext gateContext = new UnitTestGateContext { AlwaysReturnApplicable = false, ApplicableGates = new List <string>() { "Test.Gate1", "Test.Gate2" } }; 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 gate"); Assert.Equal("Test.Gate1", gates.First().FullyQualifiedName); }
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); }
public void GatedCode_UsingDefaultConstructor_BaseLineCodeFlagIsTrue() { GatedCode gatedCode = new GatedCode(); Assert.True(gatedCode.IsBaselineCode, "Default Constructor should set BaseLineCodeFlag as true"); }