Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        public void CanGetInverseOfRelationshipForCollectionProperties()
        {
            // Arrange.
            var comment = new Comment();

            // Act.
            var result = EmbeddedDocumentUtility.GetParentPropertyName <Comment, BlogPost>(comment);

            // Assert.
            Assert.That(result, Is.EqualTo("Comments"));
        }
Ejemplo n.º 3
0
        public void CanGetInverseOfRelationshipForNonCollectionProperties()
        {
            // Arrange.
            var address = new Address();

            // Act.
            var result = EmbeddedDocumentUtility.GetParentPropertyName <Address, Person>(address);

            // Assert.
            Assert.That(result, Is.EqualTo("Address"));
        }