예제 #1
0
        public void MustBePending_NonDraft_ReturnsError(
            [Values(
                 Roles.Buyer,
                 Roles.Supplier,
                 Roles.Admin
                 )]
            string role,
            [Values(
                 StandardsApplicableStatus.Submitted,
                 StandardsApplicableStatus.Remediation,
                 StandardsApplicableStatus.Approved,
                 StandardsApplicableStatus.ApprovedFirstOfType,
                 StandardsApplicableStatus.ApprovedPartial,
                 StandardsApplicableStatus.Rejected
                 )]
            StandardsApplicableStatus status)
        {
            _context.Setup(x => x.HttpContext).Returns(Creator.GetContext(role: role));
            var validator = new StandardsApplicableValidator(_context.Object, _logger.Object, _claimDatastore.Object, _contactsDatastore.Object, _solutionsDatastore.Object);
            var claim     = Creator.GetStandardsApplicable(status: status);

            validator.MustBePending();
            var valres = validator.Validate(claim);

            valres.Errors.Should()
            .ContainSingle(x => x.ErrorMessage == "Only supplier can delete a draft claim")
            .And
            .HaveCount(1);
        }
예제 #2
0
        public void MustBePending_Draft_Succeeds(
            [Values(Roles.Supplier)]
            string role,
            [Values(StandardsApplicableStatus.Draft, StandardsApplicableStatus.NotStarted)]
            StandardsApplicableStatus status)
        {
            _context.Setup(x => x.HttpContext).Returns(Creator.GetContext(role: role));
            var validator = new StandardsApplicableValidator(_context.Object, _logger.Object, _claimDatastore.Object, _contactsDatastore.Object, _solutionsDatastore.Object);
            var claim     = Creator.GetStandardsApplicable(status: status);

            validator.MustBePending();
            var valres = validator.Validate(claim);

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