Beispiel #1
0
        public void データの無いDATの保存()
        {
            //setUp
            string fileName = "iniDbTestTmp"; //テンポラリファイル名
            string progDir  = Directory.GetCurrentDirectory();
            string path     = string.Format("{0}\\{1}.ini", progDir, fileName);
            IniDb  sut      = new IniDb(progDir, fileName);

            ListVal listVal = new ListVal();
            var     l       = new ListVal();

            l.Add(new OneVal("mimeExtension", "", Crlf.Nextline, new CtrlTextBox("Extension", 10)));
            l.Add(new OneVal("mimeType", "", Crlf.Nextline, new CtrlTextBox("MIME Type", 50)));
            var oneVal = new OneVal("mime", null, Crlf.Nextline, new CtrlDat("comment", l, 350, LangKind.Jp));

            listVal.Add(oneVal);

            sut.Save("Basic", listVal); // nameTagは"Basic"で決め打ちされている

            //exercise
            var    lines  = File.ReadAllLines(path);
            string actual = lines[0];

            //verify
            Assert.That(actual, Is.EqualTo("DAT=Basic\bmime="));
            //tearDown
            sut.Delete();
        }
Beispiel #2
0
        public void IsDebugTrueの時のToReg出力(CtrlType ctrlType, bool isDebug, String str, String expected)
        {
            //setUp
            OneVal sut = Assistance.CreateOneVal(ctrlType, str);
            //exercise
            String actual = sut.ToReg(isDebug);

            //verify
            Assert.That(actual, Is.EqualTo(expected));
        }
Beispiel #3
0
        public void FromRegで設定した値をtoRegで取り出す(CtrlType ctrlType, String str)
        {
            //setUp
            const bool isSecret = false;
            OneVal     sut      = Assistance.CreateOneVal(ctrlType, null);

            sut.FromReg(str);
            var expected = str;
            //exercise
            String actual = sut.ToReg(isSecret);

            //verify
            Assert.That(actual, Is.EqualTo(expected));
        }
Beispiel #4
0
        public void 設定ファイルにテキストでセットしてreadして当該設定が読み込めるかどうか(CtrlType ctrlType, string value, string regStr)
        {
            //setUp
            string fileName = "iniDbTestTmp"; //テンポラリファイル名
            //string progDir = new File(".").getAbsoluteFile().getParent();
            string progDir = Directory.GetCurrentDirectory();
            string path    = string.Format("{0}\\{1}.ini", progDir, fileName);


            IniDb sut = new IniDb(progDir, fileName);

            sut.Delete();

            String expected = value;

            //exercise
            List <string> lines = new List <string>();

            lines.Add(regStr);
            File.WriteAllLines(path, lines);

            ListVal listVal = new ListVal();

            listVal.Add(Assistance.createOneVal(ctrlType, null));
            sut.Read("Basic", listVal); // nameTagは"Basic"で決め打ちされている
            OneVal oneVal = listVal.Search("name");

            string actual = oneVal.ToReg(false);

            //verify
            Assert.That(actual, Is.EqualTo(expected));


            //TearDown
            sut.Delete();
        }
Beispiel #5
0
 public void Add(OneVal oneVal)
 {
     ListVal.Add(oneVal);
 }