public void MustBeSupplier_Supplier_Succeeds(string role) { _context.Setup(x => x.HttpContext).Returns(Creator.GetContext(role: role)); var validator = new DummyValidatorBase(_context.Object, _logger.Object); var evidence = Creator.GetEvidenceBase(); validator.MustBeSupplier(); var valres = validator.Validate(evidence); valres.Errors.Should().BeEmpty(); }
public void MustBeSupplier_NonSupplier_ReturnsError(string role) { _context.Setup(x => x.HttpContext).Returns(Creator.GetContext(role: role)); var validator = new DummyValidatorBase(_context.Object, _logger.Object); var evidence = Creator.GetEvidenceBase(); validator.MustBeSupplier(); var valres = validator.Validate(evidence); valres.Errors.Should() .ContainSingle(x => x.ErrorMessage == "Must be supplier") .And .HaveCount(1); }