public void Should_not_return_values_from_optional_reference_until_all_of_the_references_properties_have_been_set() { _model = new StaffEducationOrganizationAssignmentAssociation(); _modelInterface = _model; // This property is "unified" with other references _modelInterface.StaffUniqueId = "ABC123"; // Because it's shared by multiple references, this property should return its value // immediately (it's not **specific** to the optional reference) _modelInterface.StaffUniqueId.ShouldBe("ABC123"); All_optional_reference_properties_should_still_return_null_values(); // --------------------------------------------------------- // These properties are specific to the optional reference // --------------------------------------------------------- _modelInterface.EmploymentEducationOrganizationId = 123; All_optional_reference_properties_should_still_return_null_values(); Optional_reference_should_still_be_null(); _modelInterface.EmploymentStatusDescriptor = "XYZ"; All_optional_reference_properties_should_still_return_null_values(); Optional_reference_should_still_be_null(); // After the last property specific to the optional reference is set, they should all return values (reference is complete) _modelInterface.EmploymentHireDate = DateTime.Today; All_of_the_optional_reference_properties_should_now_return_values(); Optional_reference_should_NOT_be_null(); }
protected override void Act() { // Perform the action to be tested _model = new StaffEducationOrganizationAssignmentAssociation(); // Populate the instance's value, including the shared FK value, but none of the optional reference's values _modelInterface = _model; // Set only the required "key" properties on the main model _modelInterface.StaffUniqueId = "ABC123"; // This also serves as part of the optional reference, but is "unified" (or shared) from other references. _modelInterface.EducationOrganizationId = 123; _modelInterface.StaffClassificationDescriptor = "Hello"; _modelInterface.BeginDate = DateTime.Today; // NOTE: No other properties for the optional reference have been set _actualSerializedJson = JsonConvert.SerializeObject(_model); }