示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
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);
        }
示例#5
0
        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);
        }
示例#6
0
        public void GatedCode_UsingDefaultConstructor_BaseLineCodeFlagIsTrue()
        {
            GatedCode gatedCode = new GatedCode();

            Assert.True(gatedCode.IsBaselineCode, "Default Constructor should set BaseLineCodeFlag as true");
        }