コード例 #1
0
        public void CanAdd_should_throw_exception_if_name_exists()
        {
            var patterns_1 = patterns_0.Add(DomainId.NewGuid(), "any", "[a-z]", "Message");

            var command = new AddPattern {
                PatternId = patternId, Name = "any", Pattern = ".*"
            };

            ValidationAssert.Throws(() => GuardAppPatterns.CanAdd(patterns_1, command),
                                    new ValidationError("A pattern with the same name already exists."));
        }
コード例 #2
0
ファイル: AppPatternsTests.cs プロジェクト: wensincai/squidex
        public void Should_add_pattern()
        {
            var patterns_1 = patterns_0.Add(id, "NewPattern", "New Pattern", "Message");

            patterns_1[id].Should().BeEquivalentTo(new AppPattern("NewPattern", "New Pattern") with {
                Message = "Message"
            });
コード例 #3
0
        public void CanAdd_should_throw_exception_if_name_exists()
        {
            var patterns_1 = patterns_0.Add(Guid.NewGuid(), "any", "[a-z]", "Message");

            var command = new AddPattern {
                PatternId = patternId, Name = "any", Pattern = ".*"
            };

            Assert.Throws <ValidationException>(() => GuardAppPattern.CanAdd(patterns_1, command));
        }
コード例 #4
0
ファイル: AppPatternsTests.cs プロジェクト: zxbe/squidex
        public void Should_add_pattern()
        {
            var patterns_2 = patterns_1.Add(id, "NewPattern", "New Pattern", "Message");

            patterns_2[id].Should().BeEquivalentTo(new AppPattern("NewPattern", "New Pattern", "Message"));
        }