Exemple #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 });
     }
 }
Exemple #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 });
     }
 }
Exemple #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 });
     }
 }
Exemple #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");
            }
        }
Exemple #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 });
            }
        }
Exemple #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 });
            }
        }
Exemple #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");
            }
        }
Exemple #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 });
            }
        }
        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");
            }
        }
        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 });
            }
        }