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)); }
bool Comparison(ObjectWithSimpleProperties first, ObjectWithSimpleProperties second) => first.Text == second.Text && first.Value == second.Value;
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)); }
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}")); }