コード例 #1
0
 public void List_Load_should_throw_exception_for_empty_list_when_shouldAllowEmptyList_is_false()
 {
     AssertExceptionThrown
     .OfType <ConfigurationErrorsException>()
     .WithMessage("Error loading from the \"EmptyBars\" section of the .config file: Item count = zero.")
     .WhenExecuting(() =>
                    ConfigurationSectionListDeserializer.Load <Bar>("EmptyBars", shouldAllowEmptyList: false));
 }
コード例 #2
0
 public void List_Load_should_throw_ConfigurationErrorsException_when_section_is_not_found_and_shouldThrowExceptionIfSectionNotFound_is_true()
 {
     AssertExceptionThrown
     .OfType <ConfigurationErrorsException>()
     .WithMessage("Error loading from the \"Barx\" section of the .config file:"
                  + " Section not found.")
     .WhenExecuting(() =>
                    ConfigurationSectionListDeserializer.Load <Bar>("Barx", shouldThrowExceptionIfSectionNotFound: true));
 }
コード例 #3
0
        public void List_Load_should_not_throw_ConfigurationErrorsException_when_section_is_not_found_and_shouldThrowExceptionIfSectionNotFound_is_false()
        {
            IList <Bar> bars =
                ConfigurationSectionListDeserializer.Load <Bar>(
                    "Barx",
                    shouldThrowExceptionIfSectionNotFound: false,
                    shouldAllowEmptyList: true);

            Assert.IsNull(bars);
        }
コード例 #4
0
        public void DependencyProvider_method_should_work()
        {
            var provider = ConfigurationSectionListDeserializer.DependencyProvider <Bar>("Bars");

            AssertBarList(provider.GetValue());
        }
コード例 #5
0
        public void List_Load_should_not_throw_exception_for_empty_list_when_shouldAllowEmptyList_is_true()
        {
            IList <Bar> bars = ConfigurationSectionListDeserializer.Load <Bar>("EmptyBars", shouldAllowEmptyList: true);

            Assert.AreEqual(0, bars.Count);
        }
コード例 #6
0
        public void List_Load_should_work()
        {
            IList <Bar> bars = ConfigurationSectionListDeserializer.Load <Bar>("Bars");

            AssertBarList(bars);
        }