Esempio n. 1
0
        public void CallingValidateIncrementsNumberOfValidationCallsCounter()
        {
            GenericValidatorWrapper <object>  validator = new GenericValidatorWrapper <object>(new MockValidator(false));
            ValidationInstrumentationListener instrumentationListener = new ValidationInstrumentationListener(true, false, false, formatter);

            new ReflectionInstrumentationBinder().Bind(validator.GetInstrumentationEventProvider(), instrumentationListener);

            validator.Validate(this);
            Assert.AreEqual(1L, validationCallsCounter.RawValue);
        }
Esempio n. 2
0
        public void SuccessfulValidationIncrementsValidationSuccessCounterPerSecond()
        {
            GenericValidatorWrapper <object>  validator = new GenericValidatorWrapper <object>(new MockValidator(false));
            ValidationInstrumentationListener instrumentationListener = new ValidationInstrumentationListener(true, false, false, formatter);

            new ReflectionInstrumentationBinder().Bind(validator.GetInstrumentationEventProvider(), instrumentationListener);

            validator.Validate(this);
            Assert.AreEqual(1L, validationSucceededPerSecond.RawValue);
        }
Esempio n. 3
0
        public void PercentageSuccessIsUpdated()
        {
            GenericValidatorWrapper <object> ValidValidator   = new GenericValidatorWrapper <object>(new MockValidator(false));
            GenericValidatorWrapper <object> InValidValidator = new GenericValidatorWrapper <object>(new MockValidator(true));

            ValidationInstrumentationListener instrumentationListener = new ValidationInstrumentationListener(true, false, false, formatter);

            new ReflectionInstrumentationBinder().Bind(ValidValidator.GetInstrumentationEventProvider(), instrumentationListener);
            new ReflectionInstrumentationBinder().Bind(InValidValidator.GetInstrumentationEventProvider(), instrumentationListener);


            ValidValidator.Validate(this);
            ValidValidator.Validate(this);
            ValidValidator.Validate(this);

            Assert.AreEqual(100f, percentageValidationSuccesses.NextValue());

            InValidValidator.Validate(this);
            Assert.AreEqual(75f, percentageValidationSuccesses.NextValue());
        }