コード例 #1
0
        public void Object_can_be_retrieved_from_configuration(ConfigurationBuilder configurationBuilder, ObjectWithSimpleProperties testSource)
        {
            configurationBuilder.AddObject(testSource);

            var configuration = configurationBuilder.Build();

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

            Assert.That(result.Text, Is.EqualTo(testSource.Text));
            Assert.That(result.Value, Is.EqualTo(testSource.Value));
        }
コード例 #2
0
 bool Comparison(ObjectWithSimpleProperties first, ObjectWithSimpleProperties second) => first.Text == second.Text && first.Value == second.Value;
コード例 #3
0
        public void Null_values_should_not_override_existing_values(ConfigurationBuilder configurationBuilder, ObjectWithSimpleProperties testSource)
        {
            configurationBuilder.AddObject(testSource);

            configurationBuilder.AddObject(new ObjectWithSimpleProperties {
                Text = null, Value = testSource.Value
            });

            var configuration = configurationBuilder.Build();

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

            Assert.That(result.Text, Is.EqualTo(testSource.Text));
            Assert.That(result.Value, Is.EqualTo(testSource.Value));
        }
コード例 #4
0
        public void Object_is_added_to_configuration(ConfigurationBuilder configurationBuilder, ObjectWithSimpleProperties testSource)
        {
            configurationBuilder.AddObject(testSource);

            var configuration = configurationBuilder.Build();

            Assert.That(configuration[nameof(testSource.Text)], Is.EqualTo($"{testSource.Text}"));
            Assert.That(configuration[nameof(testSource.Value)], Is.EqualTo($"{testSource.Value}"));
        }