public void TransformToIntOnlyAliasWasnotAppliedAndOnlyOneKey() { Schemator schemator = new Schemator(new List <DataSourceSchemaItem>() { new DataSourceSchemaItem() { //Alias = "MOMO", ColumnName = "Col1", Type = ValueType.Int } }); var sourceContext = new SourceContext(); sourceContext.Source["Col1"] = "1"; schemator.Schema(sourceContext); Assert.AreEqual(1, sourceContext.Source["Col1"]); Assert.AreEqual(1, sourceContext.Source.Keys.Count); }
public void TransformCases(object from, ValueType type, object result) { Schemator schemator = new Schemator(new List <DataSourceSchemaItem>() { new DataSourceSchemaItem() { Alias = "MOMO", ColumnName = "Col1", Type = type } }); var sourceContext = new SourceContext(); sourceContext.Source["Col1"] = from; schemator.Schema(sourceContext); Assert.AreEqual(result, sourceContext.Source["MOMO"]); Assert.AreEqual(1, sourceContext.Source.Keys.Count); }
public void TransformToIntIsRequired() { Schemator schemator = new Schemator(new List <DataSourceSchemaItem>() { new DataSourceSchemaItem() { Alias = "MOMO", ColumnName = "Col1", Type = ValueType.Int, IsRequired = true } }); var sourceContext = new SourceContext(); sourceContext.Source["Col1"] = null; schemator.Schema(sourceContext); Assert.IsTrue(sourceContext.SourceCellErrors["Col1"][0].Message.ToLower().Contains("missed")); }