Esempio n. 1
0
		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);
		}
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
		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]);
		}
Esempio n. 4
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]);
		}
Esempio n. 5
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]);
        }
Esempio n. 6
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]);
        }
Esempio n. 7
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);
        }