Example #1
0
 public void ShouldThowUserExceptionOnInsert()
 {
     using (var container = new RhetosTestContainer())
     {
         var repository = container.Resolve<Common.DomRepository>();
         var entity = new SimpleMaxLength { StringLessThan10Chars = "More than 10 characters." };
         repository.TestLengthLimit.SimpleMaxLength.Insert(new[] { entity });
     }
 }
Example #2
0
 public void ShouldThowUserExceptionOnInsert()
 {
     using (var executionContext = new CommonTestExecutionContext())
     {
         var repository = new Common.DomRepository(executionContext);
         var entity = new SimpleMaxLength { StringLessThan10Chars = "More than 10 characters." };
         repository.TestLengthLimit.SimpleMaxLength.Insert(new[] { entity });
     }
 }
Example #3
0
        public void ShouldThowUserExceptionOnInsert()
        {
            using (var container = new RhetosTestContainer())
            {
                var repository = container.Resolve<Common.DomRepository>();
                var entity = new SimpleMaxLength { StringLessThan10Chars = "More than 10 characters." };

                TestUtility.ShouldFail<Rhetos.UserException>(
                    () => repository.TestLengthLimit.SimpleMaxLength.Insert(entity),
                    "StringLessThan10Chars", "maximum", "10");
            }
        }
        public void ShouldThowUserExceptionOnInsert()
        {
            using (var scope = TestScope.Create())
            {
                var repository = scope.Resolve <Common.DomRepository>();
                var entity     = new SimpleMaxLength {
                    StringLessThan10Chars = "More than 10 characters."
                };

                TestUtility.ShouldFail <Rhetos.UserException>(
                    () => repository.TestLengthLimit.SimpleMaxLength.Insert(entity),
                    "StringLessThan10Chars", "maximum", "10");
            }
        }
Example #5
0
        public void ShouldInsertEntity()
        {
            using (var container = new RhetosTestContainer())
            {
                container.Resolve<ISqlExecuter>().ExecuteSql(new[]
                    {
                        "DELETE FROM TestLengthLimit.SimpleMaxLength;",
                    });

                var repository = container.Resolve<Common.DomRepository>();
                var entity = new SimpleMaxLength { LongStringLessThan10Chars = "abc" };
                repository.TestLengthLimit.SimpleMaxLength.Insert(new[] { entity });
            }
        }
Example #6
0
        public void ShouldInsertWithShortStringEntity()
        {
            using (var executionContext = new CommonTestExecutionContext())
            {
                executionContext.SqlExecuter.ExecuteSql(new[]
                    {
                        "DELETE FROM TestLengthLimit.SimpleMaxLength;",
                    });

                var repository = new Common.DomRepository(executionContext);
                var entity = new SimpleMaxLength { StringLessThan10Chars = "abc" };
                repository.TestLengthLimit.SimpleMaxLength.Insert(new[] { entity });
            }
        }
        public void ShouldInsertEntity()
        {
            using (var scope = TestScope.Create())
            {
                scope.Resolve <ISqlExecuter>().ExecuteSql(new[]
                {
                    "DELETE FROM TestLengthLimit.SimpleMaxLength;",
                });

                var repository = scope.Resolve <Common.DomRepository>();
                var entity     = new SimpleMaxLength {
                    LongStringLessThan10Chars = "abc"
                };
                repository.TestLengthLimit.SimpleMaxLength.Insert(new[] { entity });
            }
        }
Example #8
0
        public void ShouldThowUserExceptionOnUpdate()
        {
            using (var container = new RhetosTestContainer())
            {
                var repository = container.Resolve <Common.DomRepository>();
                var entity     = new SimpleMaxLength {
                    LongStringLessThan10Chars = "123"
                };
                repository.TestLengthLimit.SimpleMaxLength.Insert(entity);

                entity.LongStringLessThan10Chars = "More than 10 characters.";
                TestUtility.ShouldFail <Rhetos.UserException>(
                    () => repository.TestLengthLimit.SimpleMaxLength.Update(entity),
                    "StringLessThan10Chars", "maximum", "10");
            }
        }
Example #9
0
        public void ShouldInsertEntity()
        {
            using (var container = new RhetosTestContainer())
            {
                container.Resolve <ISqlExecuter>().ExecuteSql(new[]
                {
                    "DELETE FROM TestLengthLimit.SimpleMaxLength;",
                });

                var repository = container.Resolve <Common.DomRepository>();
                var entity     = new SimpleMaxLength {
                    LongStringLessThan10Chars = "abc"
                };
                repository.TestLengthLimit.SimpleMaxLength.Insert(new[] { entity });
            }
        }