public void NonEditableRefereceInsertGuid()
        {
            using (var scope = TestScope.Create())
            {
                scope.Resolve <ISqlExecuter>().ExecuteSql(new[]
                {
                    "DELETE FROM TestDenyUserEdit.Simple",
                    "DELETE FROM TestDenyUserEdit.Parent"
                });
                var repository = scope.Resolve <Common.DomRepository>();

                var parent = new TestDenyUserEdit.Parent {
                    Name = "p"
                };
                repository.TestDenyUserEdit.Parent.Save(new[] { parent }, null, null, true);

                var simple = new TestDenyUserEdit.Simple {
                    Editable = "a", NonEditableReferenceID = parent.ID
                };
                TestUtility.ShouldFail(() => repository.TestDenyUserEdit.Simple.Save(new[] { simple }, null, null, true),
                                       "Simple", "NonEditableReference", "not allowed");
            }
        }
Example #2
0
        public void NonEditableRefereceInsertGuid()
        {
            using (var container = new RhetosTestContainer())
            {
                container.Resolve<ISqlExecuter>().ExecuteSql(new[]
                    {
                        "DELETE FROM TestDenyUserEdit.Simple",
                        "DELETE FROM TestDenyUserEdit.Parent"
                    });
                var repository = container.Resolve<Common.DomRepository>();

                var parent = new TestDenyUserEdit.Parent { Name = "p" };
                repository.TestDenyUserEdit.Parent.Save(new[] { parent }, null, null, true);

                var simple = new TestDenyUserEdit.Simple { Editable = "a", NonEditableReferenceID = parent.ID };
                TestUtility.ShouldFail(() => repository.TestDenyUserEdit.Simple.Save(new[] { simple }, null, null, true),
                    "Simple", "NonEditableReference", "not allowed");
            }
        }
Example #3
0
        public void NonEditableRefereceInsertGuid()
        {
            using (var executionContext = new CommonTestExecutionContext())
            {
                executionContext.SqlExecuter.ExecuteSql(new[]
                    {
                        "DELETE FROM TestDenyUserEdit.Simple",
                        "DELETE FROM TestDenyUserEdit.Parent"
                    });
                var repository = new Common.DomRepository(executionContext);

                var parent = new TestDenyUserEdit.Parent { Name = "p" };
                repository.TestDenyUserEdit.Parent.Save(new[] { parent }, null, null, true);

                var simple = new TestDenyUserEdit.Simple { Editable = "a", NonEditableReferenceID = parent.ID };
                TestUtility.ShouldFail(() => repository.TestDenyUserEdit.Simple.Save(new[] { simple }, null, null, true),
                    "Simple", "NonEditableReference", "not allowed");
            }
        }