예제 #1
0
        public void ImportDataFromCSV_TestStringConstraints_Valid( )
        {
            EntityType type      = ImportTestHelper.CreateTestStringEntityType( );
            ImportRun  importRun = ImportTestHelper.RunTest(type, "String.csv", ImportFormat.CSV);

            //check for the import status
            Assert.That(importRun.ImportRunStatus_Enum, Is.EqualTo(WorkflowRunState_Enumeration.WorkflowRunCompleted), importRun.ImportMessages);
            Assert.That(importRun.ImportRecordsSucceeded, Is.EqualTo(5));
            Assert.That(importRun.ImportRecordsTotal, Is.EqualTo(9));
            Assert.That(importRun.ImportRecordsFailed, Is.EqualTo(4));
            Assert.That(importRun.ImportMessages, Contains.Substring("Line 2: 'State' length must not be less than 3"));
            Assert.That(importRun.ImportMessages, Contains.Substring("Line 7: 'City' value is required."));
            Assert.That(importRun.ImportMessages, Contains.Substring("Line 8: 'City' value is required."));
            Assert.That(importRun.ImportMessages, Contains.Substring("Line 3: 'String1' length must not be greater than 20"));     // this should say line 4, but there's a problem in the .Net TextFieldParser

            var instances = Entity.GetInstancesOfType(type, false);

            Assert.That(instances, Has.Count.EqualTo(5));
        }
예제 #2
0
        public void ImportDataFromExcel_TestStringConstraints_Valid( )
        {
            EntityType type      = ImportTestHelper.CreateTestStringEntityType( );
            ImportRun  importRun = ImportTestHelper.RunTest(type, ExcelFile, ImportFormat.Excel, "String");

            //check for the import status
            Assert.That(importRun.ImportRunStatus_Enum, Is.EqualTo(WorkflowRunState_Enumeration.WorkflowRunCompleted), importRun.ImportMessages);
            Assert.That(importRun.ImportRecordsSucceeded, Is.EqualTo(5), importRun.ImportMessages);
            Assert.That(importRun.ImportRecordsTotal, Is.EqualTo(9));
            Assert.That(importRun.ImportRecordsFailed, Is.EqualTo(4));
            Assert.That(importRun.ImportMessages, Contains.Substring("Row 2: 'State' length must not be less than 3"));
            Assert.That(importRun.ImportMessages, Contains.Substring("Row 7: 'City' value is required."));
            Assert.That(importRun.ImportMessages, Contains.Substring("Row 8: 'City' value is required."));
            Assert.That(importRun.ImportMessages, Contains.Substring("Row 3: 'String1' length must not be greater than 20"));

            var instances = Entity.GetInstancesOfType(type, false);

            Assert.That(instances, Has.Count.EqualTo(5));
        }