public void ShouldNotProduceValueForFieldsThatGeneratesValueOnInsert()
        {
            ValueStore valuestore = new ValueStore();
            var        dp         = new DataProducer(valuestore);

            var tables = new List <ExecutionTable>();

            tables.Add(new ExecutionTable(customerTable, 1));
            List <DataRowEntity> rows = new List <DataRowEntity>();

            rows.AddRange(dp.ProduceRows(tables));

            var row   = rows[0];
            var value = valuestore.GetByKey(row.Fields[0].KeyValue);

            Assert.That(row.Fields[0].ProducesValue, Is.True);
            Assert.That(value, Is.Null);
        }
        public void ShouldGenerateUniqueValuesForTwoRowsOfSameTable()
        {
            ValueStore valuestore = new ValueStore();
            var        dp         = new DataProducer(valuestore);

            var tables = new List <ExecutionTable>();

            tables.Add(new ExecutionTable(customerTable, 1));
            tables.Add(new ExecutionTable(customerTable, 2));

            List <DataRowEntity> rows = new List <DataRowEntity>();

            rows.AddRange(dp.ProduceRows(tables));
            Assert.That(rows.Count, Is.EqualTo(2));

            // Only one not nullable column in this table... not much of a test after all this work
            Assert.That(valuestore.GetByKey(rows[0].Fields[1].KeyValue), Is.Not.EqualTo(valuestore.GetByKey(rows[1].Fields[1].KeyValue)));
        }
 public void Consume(IEnumerable <DataRowEntity> rows, ValueStore valueStore)
 {
     ValidateInitialized();
     foreach (var row in rows)
     {
         rowCounter++;
         _reportInsertion();
         RowValidator(row);
         foreach (var field in row.Fields)
         {
             if (field.ProducesValue)
             {
                 valueStore.Put(field.KeyValue, identityCounter++);
             }
             var value = valueStore.GetByKey(field.KeyValue);
             ValueValidator(value);
             //    Console.WriteLine(value);
         }
     }
 }