public void Should_RuleTemplate_Add_Command_WithoutArgs() { Predicate <object> predicate = x => true; ApiTester.TestSingleCommand <object, IRuleIn <object>, IRuleIn <object>, RuleCommand <object> >( s => s.RuleTemplate(predicate, "messageKey", null), command => { command.Args.Should().BeNull(); command.Message.Should().Be("messageKey"); command.Predicate.Should().BeSameAs(predicate); }); }
public void Should_Add_MemberCommand() { Specification <string> memberSpecification = s => s; Expression <Func <TestClass, string> > memberSelector = m => m.TestProperty; ApiTester.TestSingleCommand <TestClass, IRuleIn <TestClass>, IRuleOut <TestClass>, MemberCommand <TestClass, string> >( s => s.Member(memberSelector, memberSpecification), command => { command.Specification.Should().NotBeNull(); command.Specification.Should().BeSameAs(memberSpecification); command.MemberSelector.Should().NotBeNull(); command.MemberSelector.Should().BeSameAs(memberSelector); }); }
public void Should_RuleTemplate_Add_Command() { Predicate <object> predicate = x => true; var args = new[] { Arg.Text("1", "1"), Arg.Number("2", 2), Arg.Type("3", typeof(Guid)) }; ApiTester.TestSingleCommand <object, IRuleIn <object>, IRuleIn <object>, RuleCommand <object> >( s => s.RuleTemplate(predicate, "messageKey", args), command => { command.Args.Should().BeSameAs(args); command.Args.Count.Should().Be(3); command.Args.Should().Contain(args); command.Message.Should().Be("messageKey"); command.Predicate.Should().BeSameAs(predicate); }); }
public void Should_Required_Add_RequiredCommand_When_Nullable() { ApiTester.TestSingleCommand <int?, IRequiredIn <int?>, IRequiredOut <int?>, RequiredCommand>( s => s.Required()); }
public void Should_Required_Add_RequiredCommand() { ApiTester.TestSingleCommand <object, IRequiredIn <object>, IRequiredOut <object>, RequiredCommand>( s => s.Required()); }
public void Should_Forbidden_Add_ForbiddenCommand_When_Nullable() { ApiTester.TestSingleCommand <int?, IForbiddenIn <int?>, IForbiddenOut <int?>, ForbiddenCommand>( s => s.Forbidden()); }
public void Should_Forbidden_Add_ForbiddenCommand() { ApiTester.TestSingleCommand <object, IForbiddenIn <object>, IForbiddenOut <object>, ForbiddenCommand>( s => s.Forbidden()); }
public void Should_Add_OptionalCommand_When_Nullable() { ApiTester.TestSingleCommand <int?, IOptionalIn <int?>, IOptionalOut <int?>, OptionalCommand>( s => s.Optional()); }
public void Should_Add_OptionalCommand() { ApiTester.TestSingleCommand <object, IOptionalIn <object>, IOptionalOut <object>, OptionalCommand>( s => s.Optional()); }