Esempio n. 1
0
        public void Create_Calls_Modifier()
        {
            var logic    = new DummyEvidenceLogicBase(_modifier.Object, _datastore.Object, _contacts.Object, _validator.Object, _filter.Object, _context.Object);
            var evidence = Creator.GetEvidenceBase(originalDate: DateTime.MinValue);

            logic.Create(evidence);

            _modifier.Verify(x => x.ForCreate(evidence), Times.Once);
        }
Esempio n. 2
0
        public void Create_CallsValidator_WithRuleset()
        {
            _context.Setup(x => x.HttpContext).Returns(Creator.GetContext());
            _contacts.Setup(x => x.ByEmail(It.IsAny <string>())).Returns(Creator.GetContact());
            var logic    = new DummyEvidenceLogicBase(_modifier.Object, _datastore.Object, _contacts.Object, _validator.Object, _filter.Object, _context.Object);
            var evidence = Creator.GetEvidenceBase();

            var valres = new ValidationResult();

            _validator.Setup(x => x.Validate(It.IsAny <ValidationContext>())).Returns(valres);

            logic.Create(evidence);

            _validator.Verify(x => x.ValidateAndThrowEx(
                                  It.Is <DummyEvidenceBase>(ev => ev == evidence),
                                  It.Is <string>(rs => rs == nameof(IEvidenceLogic <EvidenceLogicBase <EvidenceBase> > .Create))), Times.Once());
        }