コード例 #1
0
ファイル: TestDataSets.cs プロジェクト: mindis/Transformalize
        public void Test1() {

            var data = new List<Dictionary<string, string>>{
                new Dictionary<string, string> {{"f1", "1"}, {"f2", "1"}, {"f3", new DateTime(2001, 1, 1).ToString()}},
                new Dictionary<string, string> {{"f1", "2"}, {"f2", "2"}, {"f3", new DateTime(2002, 2, 2).ToString()}},
                new Dictionary<string, string> {{"f1", "3"}, {"f2", "3"}, {"f3", new DateTime(2003, 3, 3).ToString()}}
            };

            var process = new ProcessBuilder("test")
                .DataSet("one", data)
                .Entity("one")
                    .Field("f1").PrimaryKey()
                    .Field("f2").Type("int")
                    .Field("f3").Type("datetime")
                .Process();

            var problems = process.Errors();

            foreach (var problem in problems) {
                Console.WriteLine(problem);
            }

            Assert.AreEqual(0, problems.Length);
            Assert.AreEqual(3, process.DataSets.First().Rows.Count);

            var rows = ProcessFactory.CreateSingle(process, new TestLogger()).Execute().ToList();

            Assert.AreEqual(3, rows.Count());
        }