Example #1
0
        public void Should_cascade_configuration_settings()
        {
            var configurerA = new AdHocConfigurer <TestObject>(new { Property1 = "A", Property2 = "A", Property3 = "A" });
            var configurerB = new AdHocConfigurer <TestObject>(new { Property1 = "B", Property2 = "B" });
            var configurerC = new AdHocConfigurer <TestObject>(new { Property1 = "C" });

            var configurer = new CascadingConfigurer <TestObject>(configurerA, configurerB, configurerC);
            var testObject = new TestObject();

            configurer.Configure(testObject);

            Assert.IsNotNull(testObject.Property1);
            Assert.IsNotNull(testObject.Property2);
            Assert.IsNotNull(testObject.Property3);

            Assert.AreEqual(testObject.Property1, "C");
            Assert.AreEqual(testObject.Property2, "B");
            Assert.AreEqual(testObject.Property3, "A");
        }
        public void Should_cascade_configuration_settings()
        {
            var configurerA = new AdHocConfigurer<TestObject>(new {Property1 = "A", Property2 = "A", Property3 = "A"});
            var configurerB = new AdHocConfigurer<TestObject>(new {Property1 = "B", Property2 = "B"});
            var configurerC = new AdHocConfigurer<TestObject>(new {Property1 = "C"});

            var configurer = new CascadingConfigurer<TestObject>(configurerA, configurerB, configurerC);
            var testObject = new TestObject();

            configurer.Configure(testObject);

            Assert.IsNotNull(testObject.Property1);
            Assert.IsNotNull(testObject.Property2);
            Assert.IsNotNull(testObject.Property3);

            Assert.AreEqual(testObject.Property1, "C");
            Assert.AreEqual(testObject.Property2, "B");
            Assert.AreEqual(testObject.Property3, "A");
        }