Esempio n. 1
0
 public void ShouldThowUserExceptionOnUpdate()
 {
     using (var executionContext = new CommonTestExecutionContext())
     {
         var repository = new Common.DomRepository(executionContext);
         var entity = new SimpleMinLength { StringMoreThan2Chars = "." };
         repository.TestLengthLimit.SimpleMinLength.Update(new[] { entity });
     }
 }
Esempio n. 2
0
 public void ShouldThowUserExceptionOnInsert()
 {
     using (var container = new RhetosTestContainer())
     {
         var repository = container.Resolve<Common.DomRepository>();
         var entity = new SimpleMinLength { StringMoreThan2Chars = "." };
         repository.TestLengthLimit.SimpleMinLength.Insert(new[] { entity });
     }
 }
Esempio n. 3
0
 public void ShouldNotThrowUserExceptionOnInsert()
 {
     using (var container = new RhetosTestContainer())
     {
         var repository = container.Resolve <Common.DomRepository>();
         var entity     = new SimpleMinLength {
             StringMoreThan2Chars = ".aaa"
         };
         repository.TestLengthLimit.SimpleMinLength.Insert(new[] { entity });
     }
 }
 public void ShouldNotThrowUserExceptionOnInsert()
 {
     using (var scope = TestScope.Create())
     {
         var repository = scope.Resolve <Common.DomRepository>();
         var entity     = new SimpleMinLength {
             StringMoreThan2Chars = ".aaa"
         };
         repository.TestLengthLimit.SimpleMinLength.Insert(new[] { entity });
     }
 }
Esempio n. 5
0
        public void ShouldThowUserExceptionOnInsert()
        {
            using (var container = new RhetosTestContainer())
            {
                var repository = container.Resolve<Common.DomRepository>();
                var entity = new SimpleMinLength { StringMoreThan2Chars = "." };

                TestUtility.ShouldFail<Rhetos.UserException>(
                    () => repository.TestLengthLimit.SimpleMinLength.Insert(entity),
                    "StringMoreThan2Chars", "minimum", "3");
            }
        }
Esempio n. 6
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 SimpleMinLength { StringMoreThan2Chars = "abc" };
                repository.TestLengthLimit.SimpleMinLength.Insert(new[] { entity });
            }
        }
Esempio n. 7
0
        public void ShouldInsertEntity()
        {
            using (var executionContext = new CommonTestExecutionContext())
            {
                executionContext.SqlExecuter.ExecuteSql(new[]
                    {
                        "DELETE FROM TestLengthLimit.SimpleMaxLength;",
                    });

                var repository = new Common.DomRepository(executionContext);
                var entity = new SimpleMinLength { StringMoreThan2Chars = "abc" };
                repository.TestLengthLimit.SimpleMinLength.Insert(new[] { entity });
            }
        }
Esempio n. 8
0
        public void ShouldThowUserExceptionOnInsert()
        {
            using (var container = new RhetosTestContainer())
            {
                var repository = container.Resolve <Common.DomRepository>();
                var entity     = new SimpleMinLength {
                    StringMoreThan2Chars = "."
                };

                TestUtility.ShouldFail <Rhetos.UserException>(
                    () => repository.TestLengthLimit.SimpleMinLength.Insert(entity),
                    "StringMoreThan2Chars", "minimum", "3");
            }
        }
Esempio n. 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 SimpleMinLength {
                    StringMoreThan2Chars = "abc"
                };
                repository.TestLengthLimit.SimpleMinLength.Insert(new[] { entity });
            }
        }
Esempio n. 10
0
        public void ShouldThowUserExceptionOnUpdate()
        {
            using (var scope = TestScope.Create())
            {
                var repository = scope.Resolve <Common.DomRepository>();
                var entity     = new SimpleMinLength {
                    StringMoreThan2Chars = "1234"
                };
                repository.TestLengthLimit.SimpleMinLength.Insert(entity);
                entity.StringMoreThan2Chars = "1";

                TestUtility.ShouldFail <Rhetos.UserException>(
                    () => repository.TestLengthLimit.SimpleMinLength.Update(entity),
                    "StringMoreThan2Chars", "minimum", "3");
            }
        }
Esempio n. 11
0
        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 SimpleMinLength {
                    StringMoreThan2Chars = "abc"
                };
                repository.TestLengthLimit.SimpleMinLength.Insert(new[] { entity });
            }
        }