Exemple #1
0
        public void Object_is_added_to_configuration(ConfigurationBuilder configurationBuilder, ObjectWithComplexArray testSource)
        {
            configurationBuilder.AddObject(testSource);

            var configuration = configurationBuilder.Build();

            Assert.That(configuration[$"{nameof(testSource.Items)}:0:Text"], Is.EqualTo($"{testSource.Items[0].Text}"));
            Assert.That(configuration[$"{nameof(testSource.Items)}:0:Value"], Is.EqualTo($"{testSource.Items[0].Value}"));
        }
Exemple #2
0
        public void Object_can_be_retrieved_from_configuration(ConfigurationBuilder configurationBuilder, ObjectWithComplexArray testSource)
        {
            configurationBuilder.AddObject(testSource);

            var configuration = configurationBuilder.Build();

            var result = configuration.Get <ObjectWithComplexArray>();

            Assert.That(result.Items, Is.EquivalentTo(testSource.Items).Using((Func <ObjectWithSimpleProperties, ObjectWithSimpleProperties, bool>)Comparison));
        }