Пример #1
0
        public void MustBeValidId_Valid_Succeeds()
        {
            var validator = new DummyClaimsValidatorBase(_context.Object, _logger.Object, _claimDatastore.Object, _contactsDatastore.Object, _solutionsDatastore.Object);
            var claim     = Creator.GetClaimsBase();

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

            valres.Errors.Should().BeEmpty();
        }
Пример #2
0
        public void MustBeValidId_NotGuid_ReturnsError()
        {
            var validator = new DummyClaimsValidatorBase(_context.Object, _logger.Object, _claimDatastore.Object, _contactsDatastore.Object, _solutionsDatastore.Object);
            var claim     = Creator.GetClaimsBase(id: "some other Id");

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

            valres.Errors.Should()
            .ContainSingle(x => x.ErrorMessage == "Invalid Id")
            .And
            .HaveCount(1);
        }
Пример #3
0
        public void MustBeValidId_Null_ReturnsError()
        {
            var validator = new DummyClaimsValidatorBase(_context.Object, _logger.Object, _claimDatastore.Object, _contactsDatastore.Object, _solutionsDatastore.Object);
            var claim     = Creator.GetClaimsBase();

            claim.Id = null;

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

            valres.Errors.Should()
            .ContainSingle(x => x.ErrorMessage == "Invalid Id")
            .And
            .ContainSingle(x => x.ErrorMessage == "'Id' must not be empty.")
            .And
            .HaveCount(2);
        }