public void CanGetValidator() { var validator = new TestValidator(); var validatorType = validator.GetType(); ServiceProviderMock .Setup(sp => sp.GetService(validatorType)) .Returns(() => validator); var result = Target.GetValidator(ValidatorUtility.GetValidatorName(validatorType)); ServiceProviderMock .Verify(sp => sp.GetService(validatorType), Times.Once); Assert.IsType(validatorType, result); }