private IBuiltComponentMapping GetMappingWithSameReferenceType(string componentType = "MyType", string rootComponentName = "Employees")
        {
            var mapping = new ComponentMapping <Employee>(componentType);

            mapping.WithReference(emp => emp.EmployedIn, "test_ref");
            mapping.WithReference(emp => emp.Roles, "test_ref");
            mapping.WithPreexistingHierarchyReference(rootComponentName);
            return(mapping);
        }
        public void ReferenceSetup_WithFirstPreexistingThenModelled_ThrowsInvalidOperationException()
        {
            // Arrange
            var mapping = new ComponentMapping <EventHubNamespace>(null);

            // Act & Assert
            var ex = Assert.Throws <InvalidOperationException>(() => mapping
                                                               .WithPreexistingHierarchyReference("Namespace")
                                                               .WithModelledHierarchyReference(eh => eh.ResourceGroup, ModelledReferenceDirection.Child));

            Assert.Equal("Can only configure a single reference where the class is the child.", ex.Message);
        }