/// <summary> /// Initializes a new instance of the <see/> class. /// </summary> /// <param name = "builder" > /// The data. /// </param> public RegionalAuthority(IBuilder builder) : base(builder) { Record = builder?.GetRecord(); BudgetFiscalYear = new BudgetFiscalYear(Record.GetField(Field.BFY)); Data = Record?.ToDictionary(); }
public void Given_an_invalid_heading_name__should_throw_an_exception() { var record = new Record(new string[] { }, new Dictionary<string, int>()); // ReSharper disable ReturnValueOfPureMethodIsNotUsed record.GetField("foo"); // ReSharper restore ReturnValueOfPureMethodIsNotUsed }
public void Given_a_valid_heading_whose_index_is_valid_for_the_record__should_return_the_corresponding_field_value() { var record = new Record(new[] { "aa", "bb" }, new Dictionary<string, int> { { "b", 1 } }); var field = record.GetField("b"); field.ShouldBeEqualTo("bb"); }
public void Given_a_valid_heading_whose_index_exceeds_the_number_of_fields__should_return_null() { var record = new Record(new[] { "aa", "bb" }, new Dictionary<string, int> { { "c", 2 } }); var field = record.GetField("c"); field.ShouldBeNull(); }
public void Given_a_value_Type_to_which_to_cast_the_value_and_the_requested_field_does_not_exist__should_throw_an_exception() { var record = new Record(new string[] { }, new Dictionary<string, int>()); // ReSharper disable once ReturnValueOfPureMethodIsNotUsed record.GetField<int>("a"); }
public void Given_index_value_exceeds_available_number_of_fields__should_throw_an_exception() { var record = new Record(new string[] { }, "a", "b"); // ReSharper disable once ReturnValueOfPureMethodIsNotUsed record.GetField(10); }
public void Given_the_record_does_not_contain_a_value_for_the_heading__should_return_null() { var record = new Record(new string[] { null }, new Dictionary<string, int>()); var field = record.GetField(0); field.ShouldBeNull(); }
public void Given_a_value_Type_to_which_to_cast_the_value_and_the_index_value_exceeds_available_number_of_fields__should_throw_an_exception() { var record = new Record(new string[] { }, new Dictionary<string, int>()); var field = record.GetField<int>(10); field.ShouldBeEqualTo(0); }
public void Given_a_valid_index_value__should_return_the_field_value() { var record = new Record(new[] { "a", "b", "c" }, new Dictionary<string, int>()); var field = record.GetField(1); field.ShouldBeEqualTo("b"); }
public void Given_a_reference_Type_to_which_to_cast_the_value_and_the_index_value_exceeds_available_number_of_fields__should_throw_an_exception() { var record = new Record(new string[] { }, new Dictionary<string, int>()); // ReSharper disable once ReturnValueOfPureMethodIsNotUsed record.GetField<string>(10); }
public void Given_a_negative_index_value__should_throw_an_exception() { var record = new Record(new string[] { }, new Dictionary<string, int>()); // ReSharper disable ReturnValueOfPureMethodIsNotUsed record.GetField(-1); // ReSharper restore ReturnValueOfPureMethodIsNotUsed }
public void Given_the_record_does_not_contain_a_value_for_the_heading__should_return_null() { var record = new Record(new string[] { }, "a"); var field = record.GetField("a"); field.ShouldBeNull(); }