Пример #1
0
//public static


    // CSVファイルから適切なCsvDataTableの派生クラスを作るファクトリメソッド
    public static CsvDataTable CreateCsvDataTable(FileInfo file)
    {
        string[][]   alldata = LoadCSV(file);
        CsvDataTable result  = null;

        try{
            if (alldata[0][0].StartsWith("テストファイルNo."))
            {
                result      = new AsDescriptionTable();
                result.Name = Path.GetFileNameWithoutExtension(file.Name);
            }
            else if (alldata[0][1].IndexOf("アクセシビリティサポーテッド検証結果") >= 0)
            {
                result = new AsTestResultTable();
            }
            else
            {
                result = new SuccessCriteriaTable();
            }
            if (result == null)
            {
                return(null);
            }
            Console.WriteLine("Load start: {0}", file.FullName);
            result.Load(alldata);
            Console.WriteLine("Loaded: {0} rows ({1} : {2})", result.Rows.Count, result.GetType(), result.Name);

            return(result);
        } catch (Exception e) {
            throw new Exception(string.Format("データが読めませんでした。{0} \n {1}", file.FullName, alldata[0][1]), e);
        }
    }
Пример #2
0
        public void Add_Row_Belong_ToAnother_Table_Exception()
        {
            var table = new CsvDataTable <TestData>();
            var row   = table.NewRow("lerow");

            Assert.Throws <ArgumentException>(() => _rows.Add(row));
        }
Пример #3
0
    // 特定ディレクトリからCsvDataTableを一気に読み込みます。
    private void LoadTables(DirectoryInfo csvDir)
    {
        FileInfo[] csvFiles = csvDir.GetFiles("*.csv");
        List <AsDescriptionTable> descTableList   = new List <AsDescriptionTable>();
        List <AsTestResultTable>  resultTableList = new List <AsTestResultTable>();

        foreach (FileInfo f in csvFiles)
        {
            CsvDataTable cdt = CsvDataTable.CreateCsvDataTable(f);
            if (cdt is AsDescriptionTable)
            {
                descTableList.Add(cdt as AsDescriptionTable);
            }
            else if (cdt is AsTestResultTable)
            {
                resultTableList.Add(cdt as AsTestResultTable);
            }
            else if (cdt is SuccessCriteriaTable)
            {
                SuccessCriteriaTable = cdt as SuccessCriteriaTable;
                // 達成基準リストXMLにはファイル有無の情報を追加する
                SuccessCriteriaTable.CheckFileExists(csvDir);
            }
        }
        AsDescriptionTables = descTableList.ToArray();
        resultTableList.Sort();
        AsTestResultTables = resultTableList.ToArray();

        //UAのリストを作成
        List <string> uaList = new List <string>();

        foreach (var table in resultTableList)
        {
            if (!uaList.Contains(table.UserAgent))
            {
                uaList.Add(table.UserAgent);
            }
        }
        UserAgentList = uaList.ToArray();

        Console.WriteLine();
        Console.WriteLine("ロードが完了しました。");
        Console.WriteLine();
        Console.WriteLine("UserAgentの一覧:");
        foreach (string s in UserAgentList)
        {
            Console.WriteLine(s);
        }
        Console.WriteLine("AsTestResultTables:");
        foreach (var table in AsTestResultTables)
        {
            Console.WriteLine("{0} ({1}rows)", table.Name, table.Rows.Count);
        }

        Console.WriteLine("Load Completed.");
    }
        public void GetTable_ValidItem_ReturnsSameInstance()
        {
            var row1 = new CsvDataTable <ObstacleData>();

            _table.Add(row1);

            var retRow1 = _table.GetTable(typeof(ObstacleData));

            Assert.AreSame(row1, retRow1);
        }
        public void GetTable_InvalidArgs_Exception()
        {
            var row1 = new CsvDataTable <BuildingData>();

            _table.Add(row1);

            Assert.Throws <ArgumentNullException>(() => _table.GetTable(null));
            Assert.Throws <ArgumentException>(() => _table.GetTable(typeof(object)));
            Assert.Throws <ArgumentException>(() => _table.GetTable(typeof(CsvData)));
        }
        public void GetTableT_ValidItem_ReturnsSameInstance()
        {
            var row1 = new CsvDataTable <BuildingData>();

            _table.Add(row1);

            var retRow1 = _table.GetTable <BuildingData>();

            Assert.AreSame(row1, retRow1);
        }
Пример #7
0
 public CsvDataTable(CsvDataTable copyData)
 {
     this.NationalLocalGovernmentCode = copyData.NationalLocalGovernmentCode;
     this.OldPostalCode = copyData.OldPostalCode;
     this.PostalCode = copyData.PostalCode;
     this.Prefectures = copyData.Prefectures;
     this.City = copyData.City;
     this.TownArea = copyData.TownArea;
     this.PrefecturesKANZI = copyData.PrefecturesKANZI;
     this.CityKANZI = copyData.CityKANZI;
     this.TownAreaKANZI = copyData.TownAreaKANZI;
     this.Case1 = copyData.Case1;
     this.Case2 = copyData.Case2;
     this.Case3 = copyData.Case3;
     this.Case4 = copyData.Case4;
     this.Case5 = copyData.Case5;
     this.ReasonForChange = copyData.ReasonForChange;
 }
 public void Setup()
 {
     _table = new CsvDataTable <TestData>();
 }
Пример #9
0
 public void SetUp()
 {
     _table = new CsvDataTable <TestData>();
     _rows  = _table.Rows;
 }
Пример #10
0
 public void SetUp()
 {
     _table = new CsvDataTable <BuildingData>();
 }
 public void SetUp()
 {
     _table = new CsvDataTable <TestData>();
     _row   = _table.NewRow("LeRow");
 }