Esempio n. 1
0
            protected override void Arrange()
            {
                const string message =
                    "insert or update on table \"DependentTable\" violates foreign key constraint \"FK_MainTable_DependentTable\"";

                exception = NHibernateExceptionBuilder.CreatePostgresException(GenericSqlExceptionMessage, message);
            }
 protected override void Arrange()
 {
     _suppliedInsertException =
         NHibernateExceptionBuilder.CreateException(
             "could not execute batch command.[SQL: SQL not available]",
             $"The INSERT statement conflicted with the FOREIGN KEY constraint \"FK_StudentAddress_AddressType_AddressTypeId\". The conflict occurred in database \"EdFi_Ods\", table \"edfi.AddressType\", column 'AddressTypeId'.{Environment.NewLine}The statement has been terminated.{Environment.NewLine}");
 }
            protected override void Arrange()
            {
                const string message =
                    "update or delete on table \"DoublePrimaryKeys\" violates foreign key constraint \"FK_DoubleDependent_DoublePrimaryKeys\" on table \"DoubleDependent\"";

                exception = NHibernateExceptionBuilder.CreatePostgresException(GenericSqlExceptionMessage, message);
            }
Esempio n. 4
0
            protected override void Arrange()
            {
                const string slightlyWrongMessage =
                    "VViolation of PRIMARY KEY constraint 'PK_Session'. Cannot insert duplicate key in object 'edfi.Session'. The duplicate key value is (900007, 9, 2014). The statement has been terminated.";

                exception = NHibernateExceptionBuilder.CreateException("Some generic SQL Exception message", slightlyWrongMessage);
            }
Esempio n. 5
0
            protected override void Arrange()
            {
                var mess =
                    $"Violation of PRIMARY KEY constraint 'BackwardsPkName_PK'. Cannot insert duplicate key in object 'edfi.Session'. The duplicate key value is (900007, 9, 2014). {Environment.NewLine}The statement has been terminated.";

                exception = NHibernateExceptionBuilder.CreateException("Generic exception message", mess);
                suppliedMetadataProvider = Stub <IDatabaseMetadataProvider>();
                A.CallTo(() => suppliedMetadataProvider.GetIndexDetails("BackwardsPkName_PK"))
                .Returns(null);
            }
            protected override void EstablishContext()
            {
                var mess =
                    "Violation of PRIMARY KEY constraint 'BackwardsPkName_PK'. Cannot insert duplicate key in object 'edfi.Session'. The duplicate key value is (900007, 9, 2014). \r\nThe statement has been terminated.";

                exception = NHibernateExceptionBuilder.CreateException("Generic exception message", mess);
                suppliedMetadataProvider = mocks.StrictMock <IDatabaseMetadataProvider>();

                SetupResult.For(suppliedMetadataProvider.GetIndexDetails("BackwardsPkName_PK"))
                .Return(null);
            }
            protected override void EstablishContext()
            {
                const string mess =
                    "Violation of PRIMARY KEY constraint 'PK_Session'. Cannot insert duplicate key in object 'edfi.Session'. The duplicate key value is (900007, 9, 2014). \r\nThe statement has been terminated.";

                exception = NHibernateExceptionBuilder.CreateException("Generic SQL Exception message...", mess);
                suppliedMetadataProvider = mocks.StrictMock <IDatabaseMetadataProvider>();

                SetupResult.For(suppliedMetadataProvider.GetIndexDetails("PK_Session"))
                .Return(
                    new IndexDetails
                {
                    IndexName = "SomeIndexName", TableName = "Session", ColumnNames = new List <string>
                    {
                        "Column1", "Column2", "Column3"
                    }
                });
            }
Esempio n. 8
0
            protected override void Arrange()
            {
                string mess =
                    $"Violation of PRIMARY KEY constraint 'PK_Session'. Cannot insert duplicate key in object 'edfi.Session'. The duplicate key value is (900007, 9, 2014). {Environment.NewLine}The statement has been terminated.";

                exception = NHibernateExceptionBuilder.CreateException("Generic SQL Exception message...", mess);
                suppliedMetadataProvider = Stub <IDatabaseMetadataProvider>();
                A.CallTo(() => suppliedMetadataProvider.GetIndexDetails("PK_Session"))
                .Returns(
                    new IndexDetails
                {
                    IndexName   = "SomeIndexName",
                    TableName   = "Session",
                    ColumnNames = new List <string>
                    {
                        "Column1", "Column2", "Column3"
                    }
                });
            }
        protected override void Arrange()
        {
            _suppliedUpdateException = NHibernateExceptionBuilder.CreateException(
                "could not insert: [EdFi.Ods.Entities.AcademicHonorsTypeAggregate.AcademicHonorsType][SQL: INSERT INTO edfi.AcademicHonorsType (LastModifiedDate, CreateDate, Id, CodeValue, Description) VALUES (?, ?, ?, ?, ?); select SCOPE_IDENTITY()]",
                $"Cannot insert duplicate key row in object 'edfi.AcademicHonorsType' with unique index 'SomeIndexName'. The duplicate key value is (69).{Environment.NewLine}The statement has been terminated.");

            _suppliedMetadataProvider = A.Fake <IDatabaseMetadataProvider>();

            A.CallTo(() => _suppliedMetadataProvider.GetIndexDetails("SomeIndexName"))
            .Returns(
                new IndexDetails
            {
                IndexName   = "SomeIndexName",
                TableName   = "SomeTableName",
                ColumnNames = new List <string> {
                    "Column1"
                }
            });
        }
            protected override void Arrange()
            {
                const string slightlyWrongMessage = "duplicate key value violates index constraint \"PK_UsersId\"";

                exception = NHibernateExceptionBuilder.CreatePostgresException(GenericSqlExceptionMessage, slightlyWrongMessage);
            }
            protected override void Arrange()
            {
                const string message = "duplicate key value violates unique constraint \"PK_ApplicationId\"";

                exception = NHibernateExceptionBuilder.CreatePostgresException(GenericSqlExceptionMessage, message);
            }
 protected override void Arrange()
 {
     _suppliedUpdateException = NHibernateExceptionBuilder.CreateException(
         "could not delete: [something-a-rather][SQL: SQL not available]",
         $"The DELETE statement conflicted with the REFERENCE constraint \"FK_DisciplineAction_DisciplineIncident_SchoolId\". The conflict occurred in database \"EdFi_Ods\", table \"edfi.DisciplineAction\".{Environment.NewLine}The statement has been terminated.");
 }
 protected override void Arrange()
 {
     _suppliedUpdateException = NHibernateExceptionBuilder.CreateException(
         "could not update: [something-a-rather][SQL: SQL not available]",
         $"The UPDATE statement conflicted with the FOREIGN KEY constraint \"FK_Student_LimitedEnglishProficiencyType_LimitedEnglishProficiencyTypeId\". The conflict occurred in database \"EdFi_Ods\", table \"edfi.LimitedEnglishProficiencyType\", column 'LimitedEnglishProficiencyTypeId'.{Environment.NewLine}The statement has been terminated.{Environment.NewLine}");
 }
 protected override void Arrange()
 {
     _suppliedUpdateException = NHibernateExceptionBuilder.CreateException(
         "could not delete: [something-a-rather][SQL: SQL not available]",
         $"The DELETE statement conflicted with the REFERENCE constraint \"FK_CourseTranscript_CourseAttemptResultType_CourseAttemptResultTypeId\". The conflict occurred in database \"EdFi_Ods\", table \"edfi.CourseTranscript\", column 'CourseAttemptResultTypeId'.{Environment.NewLine}The statement has been terminated.");
 }