Exemple #1
0
        public void CreateTableTest()
        {
            var userDefinition = CreateDefinition();

            userDefinition.Should().NotBeNull();
            userDefinition.Name.Should().Be("User");
            userDefinition.Fields.Count.Should().Be(5);

            var importData = CreateImportData();

            importData.Should().NotBeNull();

            var importContext = new ImportProcessContext(userDefinition, importData, "*****@*****.**", Activator.CreateInstance);

            importContext.Should().NotBeNull();
            importContext.Definition.Should().NotBeNull();
            importContext.ImportData.Should().NotBeNull();

            var dataTable = this.CreateTable(importContext);

            dataTable.Should().NotBeNull();
            dataTable.Columns.Count.Should().Be(5);
            dataTable.Columns[0].ColumnName.Should().Be("EmailAddress");
            dataTable.Columns[0].DataType.Should().Be <string>();
            dataTable.Columns[1].ColumnName.Should().Be("FirstName");
            dataTable.Columns[1].DataType.Should().Be <string>();
            dataTable.Columns[2].ColumnName.Should().Be("LastName");
            dataTable.Columns[2].DataType.Should().Be <string>();
            dataTable.Columns[3].ColumnName.Should().Be("IsValidated");
            dataTable.Columns[3].DataType.Should().Be <bool>();
        }
Exemple #2
0
        public async Task CreateAndPopulateTable()
        {
            var userDefinition = CreateDefinition();

            userDefinition.Should().NotBeNull();
            userDefinition.Name.Should().Be("User");
            userDefinition.Fields.Count.Should().Be(5);

            var importData = CreateImportData();

            importData.Should().NotBeNull();

            var importContext = new ImportProcessContext(userDefinition, importData, "*****@*****.**", Activator.CreateInstance);

            importContext.Should().NotBeNull();
            importContext.Definition.Should().NotBeNull();
            importContext.ImportData.Should().NotBeNull();


            var dataTable = this.CreateTable(importContext);

            dataTable.Should().NotBeNull();

            dataTable.Columns.Count.Should().Be(5);
            dataTable.Columns[0].ColumnName.Should().Be("EmailAddress");
            dataTable.Columns[0].DataType.Should().Be <string>();

            dataTable.Columns[1].ColumnName.Should().Be("FirstName");
            dataTable.Columns[1].DataType.Should().Be <string>();

            dataTable.Columns[2].ColumnName.Should().Be("LastName");
            dataTable.Columns[2].DataType.Should().Be <string>();

            dataTable.Columns[3].ColumnName.Should().Be("IsValidated");
            dataTable.Columns[3].DataType.Should().Be <bool>();

            dataTable.Columns[4].ColumnName.Should().Be("LockoutCount");
            dataTable.Columns[4].DataType.Should().Be <int>();

            await PopulateTable(importContext, dataTable);

            dataTable.Rows.Count.Should().Be(3);

            dataTable.Rows[0][0].Should().Be("*****@*****.**");
            dataTable.Rows[0][1].Should().Be("first1");
            dataTable.Rows[0][2].Should().Be("last1");
            dataTable.Rows[0][3].Should().Be(true);
            dataTable.Rows[0][4].Should().Be(DBNull.Value);

            dataTable.Rows[1][0].Should().Be("*****@*****.**");
            dataTable.Rows[1][1].Should().Be("first2");
            dataTable.Rows[1][2].Should().Be("");
            dataTable.Rows[1][3].Should().Be(false);
            dataTable.Rows[1][4].Should().Be(DBNull.Value);

            dataTable.Rows[2][0].Should().Be("*****@*****.**");
            dataTable.Rows[2][1].Should().Be("first3");
            dataTable.Rows[2][2].Should().Be("last3");
            dataTable.Rows[2][3].Should().Be(false);
            dataTable.Rows[2][4].Should().Be(2);
        }