Exemple #1
0
        public void Validate_Buyer_AllOperations_ReturnsError(
            [ValueSource(nameof(Operations))] string operation
            )
        {
            var ctx = Creator.GetContext(role: Roles.Buyer);

            _context.Setup(c => c.HttpContext).Returns(ctx);
            var validator = new AssessmentMessageValidator(_context.Object);

            var res = validator.Validate(Creator.GetAssessmentMessage(), ruleSet: operation);

            res.Errors.Count().Should().Be(1);
        }
Exemple #2
0
        public void Validate_AdminSupplier_BySolutionCreate_ReturnsNoError(
            [Values(nameof(IAssessmentMessageLogic.BySolution), nameof(IAssessmentMessageLogic.Create))] string operation,
            [Values(Roles.Admin, Roles.Supplier)] string role
            )
        {
            var ctx = Creator.GetContext(role: role);

            _context.Setup(c => c.HttpContext).Returns(ctx);
            var validator = new AssessmentMessageValidator(_context.Object);

            var res = validator.Validate(Creator.GetAssessmentMessage(), ruleSet: operation);

            res.Errors.Should().BeEmpty();
        }