コード例 #1
0
        public void DictionaryModelReader__ctor__when__empty_dictionary__then__ArgumentException()
        {
            var modelReader = new DictionaryModelReader(new Dictionary <string, object>()
            {
            });

            Assert.IsNotNull(modelReader);
        }
コード例 #2
0
        public void DictionaryModelReader__ctor__when__empty_dictionary_and_Needed_field__then__InvalidConfigurationModelException()
        {
            var modelReader = new DictionaryModelReader(new Dictionary <string, object>()
            {
                { "NotExistingInModel", "Yellow" }
            });

            Assert.IsNotNull(modelReader);

            var model = modelReader.ReadInto <DummyAppSettingsModelWithRequiredAndOptional>();
        }
コード例 #3
0
        public void DictionaryModelReader__ctor__when__good_dictionary_and_Needed_field_with_case_sensitive__then__InvalidConfigurationModelException()
        {
            var modelReader = new DictionaryModelReader(new Dictionary <string, object>()
            {
                { "needed", "Yellow" }
            });

            modelReader.KeyComparer = StringComparison.CurrentCulture;

            Assert.IsNotNull(modelReader);

            var model = modelReader.ReadInto <DummyAppSettingsModelWithRequiredAndOptional>();
        }
コード例 #4
0
        public void DictionaryModelReader__ctor__when__good_dictionary_and_Needed_field__then__model_filled()
        {
            var modelReader = new DictionaryModelReader(new Dictionary <string, object>()
            {
                { "needed", "Yellow" }
            });

            Assert.IsNotNull(modelReader);

            var model = modelReader.ReadInto <DummyAppSettingsModelWithRequiredAndOptional>();

            Assert.AreEqual("Yellow", model.Needed);
        }