コード例 #1
0
        private static DataRow GetFirstValidRow()
        {
            var firstDataRow = new DataRow();

            firstDataRow.Values.Add("long");
            firstDataRow.Values.Add("square");
            firstDataRow.Values.Add("waffle");
            return firstDataRow;
        }
        private void EvalInputFrom(TextReader reader, EntityData entity)
        {
            string line;
            while ((line = reader.ReadLine()) != null)
            {
                if (line.StartsWith("//"))
                    continue;
                if (line.Equals(""))
                    continue;

                var values = SplitInput(line);

                if (values.Length != entity.Attributes.Count)
                {
                    var exceptionMessage = String.Format("Read {0} data\nLast line read: {1}\nExpecting {2} attributes", values.Length, line,
                                                         entity.Attributes.Count);

                    throw new DataTransformationException(exceptionMessage);
                }

                var dataRow = new DataRow();

                for (var attributeId = 0; attributeId < entity.Attributes.Count; attributeId++)
                    dataRow.Values.Add(values[attributeId]);

                entity.Data.Add(dataRow);
            }
        }
コード例 #3
0
        private static DataRow GetSecondValidDataRow()
        {
            var secondDataRow = new DataRow();

            secondDataRow.Values.Add("long");
            secondDataRow.Values.Add("rectangle");
            secondDataRow.Values.Add("waffle");
            return secondDataRow;
        }
コード例 #4
0
        private static DataRow GetFourthValidDataRow()
        {
            var fourthDataRow = new DataRow();

            fourthDataRow.Values.Add("short");
            fourthDataRow.Values.Add("rectangle");
            fourthDataRow.Values.Add("one-way");
            return fourthDataRow;
        }
コード例 #5
0
        private static DataRow GetThirdValidDataRowWithMissingValue()
        {
            var thirdDataRow = new DataRow();

            thirdDataRow.Values.Add("short");
            thirdDataRow.Values.Add("");
            thirdDataRow.Values.Add("two-way");

            return thirdDataRow;
        }
コード例 #6
0
        private static DataRow GetThirdValidDataRow()
        {
            var thirdDataRow = new DataRow();

            thirdDataRow.Values.Add("short");
            thirdDataRow.Values.Add("square");
            thirdDataRow.Values.Add("two-way");
            return thirdDataRow;
        }
コード例 #7
0
        private static DataRow GetThirdInValidDataRow()
        {
            var thirdDataRow = new DataRow();

            thirdDataRow.Values.Add("short");
            thirdDataRow.Values.Add("square");
            thirdDataRow.Values.Add("two-way");
            thirdDataRow.Values.Add("additional invald data");

            return thirdDataRow;
        }