示例#1
0
        public void ValidationErrorsThrowModelValidationException()
        {
            var    uow = new EFUnitOfWorkFactory().Create();
            Action act = () =>
            {
                var repo = new PeopleRepository();
                repo.Add(new Person());
                uow.Commit(true);
            };

            act.ShouldThrow <ModelValidationException>().WithMessage("The FirstName field is required", ComparisonMode.Substring);
            uow.Undo();
        }