public FactsBase()
            {
                _validationContext = new Mock <IValidationEntitiesContext>();
                _logger            = new Mock <ILogger <ValidatorStateService> >();

                _validationRequest = new Mock <IValidationRequest>();
                _validationRequest.Setup(x => x.NupkgUrl).Returns(NupkgUrl);
                _validationRequest.Setup(x => x.PackageId).Returns(PackageId);
                _validationRequest.Setup(x => x.PackageKey).Returns(PackageKey);
                _validationRequest.Setup(x => x.PackageVersion).Returns(PackageVersion);
                _validationRequest.Setup(x => x.ValidationId).Returns(ValidationId);

                _target = CreateValidatorStateService(ValidatorUtility.GetValidatorName(typeof(AValidator)));
            }
Пример #2
0
            public FactsBase(ITestOutputHelper output)
            {
                _output            = output ?? throw new ArgumentNullException(nameof(output));
                _validationContext = new Mock <IValidationEntitiesContext>();
                _logger            = new LoggerFactory().AddXunit(_output).CreateLogger <ValidatorStateService>();

                _validationRequest = new Mock <IValidationRequest>();
                _validationRequest.Setup(x => x.NupkgUrl).Returns(NupkgUrl);
                _validationRequest.Setup(x => x.PackageId).Returns(PackageId);
                _validationRequest.Setup(x => x.PackageKey).Returns(PackageKey);
                _validationRequest.Setup(x => x.PackageVersion).Returns(PackageVersion);
                _validationRequest.Setup(x => x.ValidationId).Returns(ValidationId);

                _target = CreateValidatorStateService(ValidatorUtility.GetValidatorName(typeof(AValidator)));
            }
Пример #3
0
            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);
            }