示例#1
0
        public void ReadSimpleStreamIniStrings()
        {
            var text    = @"
# section comment
[Section1]
i1=a
# item comment
i2=' a '
[Section2]
x=1
y=2
z=3
";
            var iniFile = IniStrings.Read(StringReaderTests.CreateStreamReader(text));

            VerifySimpleIniStrings(iniFile);
        }
示例#2
0
        public void ReadMoreCompliatedStreamIniStrings()
        {
            var text    = @"
;[connect name] will modify the connection if ADC.connect=""name""
;[connect default] will modify the connection if name is not found
;The Access is computed as follows:
;  (1) First take the access of the connect section.
;  (2) If a user entry is found, it will override.

[connect default]
;If we want to disable unknown connect values, we set Access to NoAccess
Access=NoAccess

[sql default]
;If we want to disable unknown sql values, we set Sql to an invalid query.
Sql="" ""

[connect CustomerDatabase]
Access=ReadWrite
Connect=""DSN=AdvWorks""

[sql CustomerById]
Sql=""SELECT * FROM Customers WHERE CustomerID = ?""

[connect AuthorDatabase]
Access=ReadOnly
Connect=""DSN=MyLibraryInfo;UID=MyUserID;PWD=MyPassword""

[userlist AuthorDatabase]
Administrator=ReadWrite

[sql AuthorById]
Sql=""SELECT * FROM Authors WHERE au_id = ?""

";
            var iniFile = IniStrings.Read(StringReaderTests.CreateStreamReader(text));

            VerifyMoreComplicatedIniStrings(iniFile);
        }