public void SucceedsForValidDataWithReference() { // Arrange. var validator = new DocumentUniquenessValidator <TestEntityWithReference, string>(x => x.Title) { Scope = new Expression <Func <TestEntityWithReference, object> >[] { x => x.Site } }; TestEntityWithReference.Create(new TestEntityWithReference { Site = Site.Create(new Site { Title = "Baz" }), Title = "Foo" }); var documentInstance = new TestEntityWithReference { Site = Site.Create(new Site { Title = "Bar" }), Title = "Foo" }; var context = DocumentValidationContext <TestEntityWithReference> .Create(documentInstance, SaveType.Any); // Act. var results = validator.Validate("Foo", context).ToList(); // Assert. Assert.That(results, Is.Empty); }
public void SetUp() { TestEntity.Drop(); Site.Drop(); TestEntityWithReference.Drop(); }