예제 #1
0
        public void ShouldReturnErrorWhenCombinedForeignKeysReferenceDoesNotExist()
        {
            var attachmentDataRecord = new Record(_attachmentRecordDef,
                                                  new Field(_messageIdPrimaryKeyFieldDef, "556677"),
                                                  new Field(_attachmentNumberPrimaryKeyFieldDef, "1"));

            var testRecord = new Record(_recordWithBothCombinedAndSingleForeignKeyDef,
                                        new Field(_primaryKeyFieldDef, "1234"),
                                        new Field(_foreignKeyMessageIdFieldDef, "1001"),
                                        new Field(_foreignKeyAttachmentNumberFieldDef, "1"));

            TestRun testRun = ControlForeignKeySingleTest.RunTest(attachmentDataRecord, testRecord);

            testRun.IsSuccess().Should().BeFalse();
        }
예제 #2
0
        public void ShouldReturnSuccessWhenCombinedForeignKeysAndSingleForeignKeyReferencesExist()
        {
            var attachmentDataRecord = new Record(_attachmentRecordDef,
                                                  new Field(_messageIdPrimaryKeyFieldDef, "1001"),
                                                  new Field(_attachmentNumberPrimaryKeyFieldDef, "1"));

            var documentRecord = new Record(_documentRecordDef,
                                            new Field(_documentPrimaryKeyFieldDef, "42"));

            var testRecord = new Record(_recordWithBothCombinedAndSingleForeignKeyDef,
                                        new Field(_primaryKeyFieldDef, "1234"),
                                        new Field(_foreignKeyMessageIdFieldDef, "1001"),
                                        new Field(_foreignKeyAttachmentNumberFieldDef, "1"),
                                        new Field(_foreignKeyDocumentIdFieldDef, "42"));

            TestRun testRun = ControlForeignKeySingleTest.RunTest(attachmentDataRecord, documentRecord, testRecord);

            testRun.IsSuccess().Should().BeTrue();
        }