IEnumerable <ValidationResult> IValidatableDocument.Validate(SaveType saveType) { var parentPropertyName = EmbeddedDocumentUtility.GetParentPropertyName <T, TEmbeddedIn>((T)this); var validationContext = DocumentValidationContext <T> .Create((T)this, Parent, parentPropertyName, saveType); return(ValidationUtility.Validate(Validators, validationContext)); }
public void CanGetInverseOfRelationshipForCollectionProperties() { // Arrange. var comment = new Comment(); // Act. var result = EmbeddedDocumentUtility.GetParentPropertyName <Comment, BlogPost>(comment); // Assert. Assert.That(result, Is.EqualTo("Comments")); }
public void CanGetInverseOfRelationshipForNonCollectionProperties() { // Arrange. var address = new Address(); // Act. var result = EmbeddedDocumentUtility.GetParentPropertyName <Address, Person>(address); // Assert. Assert.That(result, Is.EqualTo("Address")); }