예제 #1
0
        public void GetDefaultSettingObjectTestWithDefaultCtor()
        {
            var obj = new TestSetting {
                Text = "Test"
            };

            var source = new InMemoryConfigurationSource <TestSetting>(obj);

            var settingObject = source.GetDefaultSettingObject() as TestSetting;

            Assert.NotNull(settingObject);
            Assert.Equal("DefaultCtorText", settingObject.Text);
        }
예제 #2
0
        public void GetDefaultSettingObjectTest()
        {
            var obj        = new object();
            var defaultObj = new object();

            var source = new InMemoryConfigurationSource <object>(obj, () => defaultObj);

            var defaultSettingObject = source.GetDefaultSettingObject();
            var settingObject        = source.GetSettingObject();

            Assert.Same(defaultObj, defaultSettingObject);
            Assert.Same(obj, settingObject);
        }