WriteSection() public method

public WriteSection ( string section ) : void
section string
return void
コード例 #1
0
ファイル: IniWriterTests.cs プロジェクト: debop/NFramework
        public void KeyWithIndentation() {
            StringWriter writer = new StringWriter();
            IniWriter iniWriter = new IniWriter(writer);

            iniWriter.Indentation = 2;
            iniWriter.WriteSection("Required");
            iniWriter.WriteKey("independence day", "july");
            Assert.AreEqual("  independence day = july", ReadLine(writer, 2));
            iniWriter.Indentation = 0;
        }
コード例 #2
0
        public void ReplaceEndOfLine()
        {
            StringWriter writer    = new StringWriter();
            IniWriter    iniWriter = new IniWriter(writer);

            iniWriter.WriteSection("Required");
            iniWriter.WriteKey("thanksgiving", "November\n 25th");

            Assert.AreEqual("thanksgiving = November 25th", ReadLine(writer, 2));
        }
コード例 #3
0
ファイル: IniWriterTests.cs プロジェクト: debop/NFramework
        public void SectionWithoutComment() {
            StringWriter writer = new StringWriter();
            IniWriter iniWriter = new IniWriter(writer);

            Assert.AreEqual(IniWriteState.Start, iniWriter.WriteState);

            iniWriter.WriteSection("Test Section");
            Assert.AreEqual("[Test Section]", ReadLine(writer, 1));
            Assert.AreEqual(IniWriteState.Section, iniWriter.WriteState);
        }
コード例 #4
0
ファイル: IniWriterTests.cs プロジェクト: debop/NFramework
        public void KeyWithQuotesAndComment() {
            StringWriter writer = new StringWriter();
            IniWriter iniWriter = new IniWriter(writer);

            iniWriter.UseValueQuotes = true;
            iniWriter.WriteSection("Required");
            iniWriter.WriteKey("thanksgiving", "November 25th", "Football!");
            iniWriter.UseValueQuotes = false;
            Assert.AreEqual("thanksgiving = \"November 25th\" ; Football!",
                            ReadLine(writer, 2));
        }
コード例 #5
0
        public void FlushAndClose()
        {
            StringWriter writer    = new StringWriter();
            IniWriter    iniWriter = new IniWriter(writer);

            iniWriter.WriteSection("Required");
            iniWriter.WriteKey("thanksgiving", "november 25th", "Football!");

            iniWriter.Close();
            Assert.AreEqual(IniWriteState.Closed, iniWriter.WriteState);
        }
コード例 #6
0
        public void KeyWithIndentation()
        {
            StringWriter writer    = new StringWriter();
            IniWriter    iniWriter = new IniWriter(writer);

            iniWriter.Indentation = 2;
            iniWriter.WriteSection("Required");
            iniWriter.WriteKey("independence day", "july");
            Assert.AreEqual("  independence day = july", ReadLine(writer, 2));
            iniWriter.Indentation = 0;
        }
コード例 #7
0
        public void SectionWithoutComment()
        {
            StringWriter writer    = new StringWriter();
            IniWriter    iniWriter = new IniWriter(writer);

            Assert.AreEqual(IniWriteState.Start, iniWriter.WriteState);

            iniWriter.WriteSection("Test Section");
            Assert.AreEqual("[Test Section]", ReadLine(writer, 1));
            Assert.AreEqual(IniWriteState.Section, iniWriter.WriteState);
        }
コード例 #8
0
        public void KeyWithQuotesAndComment()
        {
            StringWriter writer    = new StringWriter();
            IniWriter    iniWriter = new IniWriter(writer);

            iniWriter.UseValueQuotes = true;
            iniWriter.WriteSection("Required");
            iniWriter.WriteKey("thanksgiving", "November 25th", "Football!");
            iniWriter.UseValueQuotes = false;
            Assert.AreEqual("thanksgiving = \"November 25th\" ; Football!",
                            ReadLine(writer, 2));
        }
コード例 #9
0
ファイル: IniWriterTests.cs プロジェクト: debop/NFramework
        public void FlushAndClose() {
            StringWriter writer = new StringWriter();
            IniWriter iniWriter = new IniWriter(writer);

            iniWriter.WriteSection("Required");
            iniWriter.WriteKey("thanksgiving", "november 25th", "Football!");

            iniWriter.Close();
            Assert.AreEqual(IniWriteState.Closed, iniWriter.WriteState);
        }
コード例 #10
0
ファイル: IniWriterTests.cs プロジェクト: debop/NFramework
        public void ReplaceEndOfLine() {
            StringWriter writer = new StringWriter();
            IniWriter iniWriter = new IniWriter(writer);

            iniWriter.WriteSection("Required");
            iniWriter.WriteKey("thanksgiving", "November\n 25th");

            Assert.AreEqual("thanksgiving = November 25th", ReadLine(writer, 2));
        }