示例#1
0
 public void Should_ThrowException_When_InvalidCodes(string code)
 {
     ApiTester.TextException <object, IWithExtraCodeIn <object>, IWithExtraCodeOut <object> >(
         s => s.WithExtraCode(code),
         addingAction =>
     {
         addingAction.Should().ThrowExactly <ArgumentException>().WithMessage("Invalid code*");
     });
 }
 public void Should_ThrowException_When_NullModelSpecification()
 {
     ApiTester.TextException <int?, IRuleIn <int?>, IRuleOut <int?> >(
         s => s.AsNullable(null),
         addingAction =>
     {
         addingAction.Should().ThrowExactly <ArgumentNullException>();
     });
 }
示例#3
0
 public void Should_ReturnFalse_For_InvalidPaths(string path)
 {
     ApiTester.TextException <object, IWithPathIn <object>, IWithPathOut <object> >(
         s => s.WithPath(path),
         addingAction =>
     {
         addingAction.Should().ThrowExactly <ArgumentException>().WithMessage("Invalid path*");
     });
 }
示例#4
0
 public void Should_WithExtraCode_ThrowException_When_NullMessage()
 {
     ApiTester.TextException <object, IWithExtraCodeIn <object>, IWithExtraCodeOut <object> >(
         s => s.WithExtraCode(null),
         addingAction =>
     {
         addingAction.Should().ThrowExactly <ArgumentNullException>();
     });
 }
示例#5
0
 public void Should_ForbiddenWithMessage_ThrowException_When_NullMessage()
 {
     ApiTester.TextException <object, IWithMessageForbiddenIn <object>, IWithMessageForbiddenOut <object> >(
         s => s.WithMessage(null),
         addingAction =>
     {
         addingAction.Should().ThrowExactly <ArgumentNullException>();
     });
 }
示例#6
0
 public void Should_ThrowException_When_NullName()
 {
     ApiTester.TextException <object, IWithPathIn <object>, IWithPathOut <object> >(
         s => s.WithPath(null),
         addingAction =>
     {
         addingAction.Should().ThrowExactly <ArgumentNullException>();
     });
 }
示例#7
0
 public void Should_Rule_ThrowException_When_NullPredicate()
 {
     ApiTester.TextException <object, IRuleIn <object>, IRuleIn <object> >(
         s => s.Rule(null),
         addingAction =>
     {
         addingAction.Should().ThrowExactly <ArgumentNullException>();
     });
 }
 public void Should_ThrowException_When_NullExecutionCondition()
 {
     ApiTester.TextException <object, IWithConditionIn <object>, IWithConditionOut <object> >(
         s => s.WithCondition(null),
         addingAction =>
     {
         addingAction.Should().ThrowExactly <ArgumentNullException>();
     });
 }
 public void Should_ThrowException_When_NullSpecification()
 {
     ApiTester.TextException <ICollection <object>, IRuleIn <ICollection <object> >, IRuleOut <ICollection <object> > >(
         s => s.AsCollection(null),
         addingAction =>
     {
         addingAction.Should().ThrowExactly <ArgumentNullException>();
     });
 }
示例#10
0
        public void Should_ThrowException_When_NullMemberSpecification()
        {
            Expression <Func <TestClass, string> > memberSelector = m => m.TestProperty;

            ApiTester.TextException <TestClass, IRuleIn <TestClass>, IRuleOut <TestClass> >(
                s => s.Member(memberSelector, null),
                addingAction =>
            {
                addingAction.Should().ThrowExactly <ArgumentNullException>();
            });
        }
示例#11
0
        public void Should_ThrowException_When_NullMemberSelector()
        {
            Specification <string> memberSpecification = s => s;

            ApiTester.TextException <TestClass, IRuleIn <TestClass>, IRuleOut <TestClass> >(
                s => s.Member(null, memberSpecification),
                addingAction =>
            {
                addingAction.Should().ThrowExactly <ArgumentNullException>();
            });
        }
示例#12
0
        public void Should_RuleTemplate_ThrowException_When_NullPredicate()
        {
            var args = new[]
            {
                Arg.Text("1", "1"),
                Arg.Number("2", 2),
                Arg.Type("3", typeof(Guid))
            };

            ApiTester.TextException <object, IRuleIn <object>, IRuleIn <object> >(
                s => s.RuleTemplate(null, "message", args),
                addingAction =>
            {
                addingAction.Should().ThrowExactly <ArgumentNullException>();
            });
        }
示例#13
0
        public void Should_RuleTemplate_ThrowException_When_NullInArgs()
        {
            Predicate <object> predicate = x => true;

            var args = new[]
            {
                Arg.Text("1", "1"),
                null,
                Arg.Type("3", typeof(Guid))
            };

            ApiTester.TextException <object, IRuleIn <object>, IRuleIn <object> >(
                s => s.RuleTemplate(predicate, "message", args),
                addingAction =>
            {
                addingAction.Should().ThrowExactly <ArgumentNullException>();
            });
        }