public void GetValidatorNonGenericShouldReturnValidatorManifest([Frozen] IGetsValidatorFromManifest validatorFromManifestFactory, BaseValidatorFactory sut, [ManifestModel] ValidationManifest manifest, IValidator validator) { Mock.Get(validatorFromManifestFactory).Setup(x => x.GetValidator(manifest)).Returns(validator); Assert.That(() => sut.GetValidator(manifest), Is.SameAs(validator)); }
public void GetValidatorGenericShouldReturnGenericValidatorFromCreatedManifest([Frozen] IGetsManifestFromBuilder manifestFromBuilderProvider, [Frozen] IGetsValidatorFromManifest validatorFromManifestFactory, BaseValidatorFactory sut, IBuildsValidator <object> builder, [ManifestModel] ValidationManifest manifest) { Mock.Get(manifestFromBuilderProvider).Setup(x => x.GetManifest(builder)).Returns(manifest); var validator = new Mock <IValidator <object> >(); var nonGenericValidator = validator.As <IValidator>(); Mock.Get(validatorFromManifestFactory).Setup(x => x.GetValidator(manifest)).Returns(nonGenericValidator.Object); Assert.That(() => sut.GetValidator(builder), Is.SameAs(nonGenericValidator.Object)); }