Exemple #1
0
        public void MustBeAdminOrSupplier_AdminSupplier_Succeeds(string role)
        {
            var ctx = Creator.GetContext(role: role);

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

            validator.MustBeAdminOrSupplier();
            var valres = validator.Validate(role);

            valres.Errors.Should().BeEmpty();
        }
Exemple #2
0
        public void MustBeAdminOrSupplier_NonAdminSupplier_ReturnsError(string role)
        {
            var ctx = Creator.GetContext(role: role);

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

            validator.MustBeAdminOrSupplier();
            var valres = validator.Validate(role);

            valres.Errors.Should()
            .ContainSingle(x => x.ErrorMessage == "Must be admin or supplier")
            .And
            .HaveCount(1);
        }