public void FluentValidator_adapter_can_be_attached_to_ObjectValidator() { // Arrange var fluentValidator = new ClassWithPropertiesValidator(); // Act IValidator sut = new ObjectValidator() .UseFluentValidator(fluentValidator); // Assert sut.Should().BeOfType <FluentValidatorAdapter>(); }
public void FluentValidator_and_ComponentModelValidator_must_work_together() { // Arrange var validator = new ObjectValidator(); var fluentValidator = new ClassWithPropertiesValidator(); var sut = new FluentValidatorAdapter(validator, new[] { fluentValidator }); // Act var actual = sut.Validate(new ClassWithProperties()); // Assert actual.Should().BeEquivalentTo(new object[] { Expectation("The PropertyWithValidation field is required.", "PropertyWithValidation"), Expectation("'Property With Validation' must not be empty.", "PropertyWithValidation") }); }