Ejemplo n.º 1
0
        public void PrioritisePlanes_SetsOrderAsExpectedIfSetBeforePlanesAdded(string firstPlane, string secondPlane, string thirdPlane,
                                                                               string fourthPlane)
        {
            ConfigControllerTestHelper sut = new ConfigControllerTestHelper();

            Queue <string> priority = new Queue <string>();

            priority.Enqueue(firstPlane);
            priority.Enqueue(secondPlane);
            priority.Enqueue(thirdPlane);
            priority.Enqueue(fourthPlane);

            sut.Priority = priority;

            sut.UpsertConfigValue("FirstPlane", "MyConfigContext", "ConfigKey", "ConfigValueFirstPlane");
            sut.UpsertConfigValue("SecondPlane", "MyConfigContext", "ConfigKey", "ConfigValueSecondPlane");
            sut.UpsertConfigValue("ThirdPlane", "MyConfigContext", "ConfigKey", "ConfigValueThirdPlane");
            sut.UpsertConfigValue("FourthPlane", "MyConfigContext", "ConfigKey", "ConfigValueFourthPlane");



            IConfigPlane planePointer = sut.GetEntryPoint();

            Assert.That(planePointer.PlaneDescriptor.Key.Equals(firstPlane, StringComparison.InvariantCulture));
            Assert.That(planePointer.Child.PlaneDescriptor.Key.Equals(secondPlane, StringComparison.InvariantCulture));
            Assert.That(planePointer.Child.Child.PlaneDescriptor.Key.Equals(thirdPlane, StringComparison.InvariantCulture));
            Assert.That(planePointer.Child.Child.Child.PlaneDescriptor.Key.Equals(fourthPlane, StringComparison.InvariantCulture));
            Assert.IsNull(planePointer.Child.Child.Child.Child);
        }
Ejemplo n.º 2
0
        public void WithSinglePlaneUpsertConfigValue_GetValueIsReadCorrectly()
        {
            ConfigControllerTestHelper sut = new ConfigControllerTestHelper();

            Queue <string> priority = new Queue <string>();

            priority.Enqueue("FirstPlane");


            sut.Priority = priority;

            sut.UpsertConfigValue("FirstPlane", "MyConfigContext", "ConfigKey", "ConfigValue");
            Dictionary <string, string> context = new Dictionary <string, string>();

            context.Add("FirstPlane", "MyConfigContext");
            sut.SearchContext = context;

            string result = sut.GetConfigValue("ConfigKey");

            Assert.NotNull(result);
            Assert.That(result.Equals("ConfigValue"));
        }
Ejemplo n.º 3
0
        public void WithSinglePlaneUpsertConfigValue_TryGetValueIsReadCorrectly()
        {
            ConfigControllerTestHelper sut = new ConfigControllerTestHelper();

            Queue <string> priority = new Queue <string>();

            priority.Enqueue("FirstPlane");


            sut.Priority = priority;

            sut.UpsertConfigValue("FirstPlane", "MyConfigContext", "ConfigKey", "ConfigValue");
            Dictionary <string, string> context = new Dictionary <string, string>();

            context.Add("FirstPlane", "MyConfigContext");
            sut.SearchContext = context;

            string configValue;
            bool   success = sut.TryGetConfigValue("ConfigKey", out configValue);

            Assert.NotNull(configValue);
            Assert.That(configValue.Equals("ConfigValue"));
            Assert.IsTrue(success);
        }