public void ConstraintsGroupingTest_AAA()
        {
            //Arrange
            IValidationMessagesLogger loggerMock = MockRepository.GenerateMock<IValidationMessagesLogger>(null);

            loggerMock.Expect(l => l.LogMessage(null)).IgnoreArguments().Constraints(
                new PropertyConstraint("Text", Rhino.Mocks.Constraints.Text.Contains("Whoa!")) &&
              Property.Value("MessageKind", ValidationMessageKind.Error))
                .Repeat.Once();

            //Act
            IValidator Validator = new Validator();
            Validator.Validate("input", loggerMock);//a validator that uses logger internally to log validation messages.

            //Assert
            loggerMock.VerifyAllExpectations();
        }
        public void ConstraintsGroupingTest()
        {
            MockRepository mocks = new MockRepository();
            IValidationMessagesLogger loggerMock = mocks.DynamicMock<IValidationMessagesLogger>(null);
            IValidator Validator = new Validator();

            using (mocks.Record())
            {
                loggerMock.LogMessage(null);
                LastCall.Constraints(/*LastCall notation is used because LogMessage(...) does not return anything (is void).*/
                  new PropertyConstraint("Text", Rhino.Mocks.Constraints.Text.Contains("Whoa!")) &&
                  Property.Value("MessageKind", ValidationMessageKind.Error))
                    .Repeat.Once();
            }//implicitly calls mocks.ReplayAll()

            Validator.Validate("input", loggerMock);//a validator that uses logger internally to log validation messages.

            mocks.VerifyAll();
        }