@@ -50,6 +50,119 @@ public void CanUnsetAnEntryFromTheGlobalConfiguration()
5050 }
5151 }
5252
53+ [ Fact ]
54+ public void CanAddAndReadMultivarFromTheLocalConfiguration ( )
55+ {
56+ string path = SandboxStandardTestRepo ( ) ;
57+ using ( var repo = new Repository ( path ) )
58+ {
59+ Assert . Empty ( repo . Config
60+ . OfType < ConfigurationEntry < string > > ( )
61+ . Where ( x => x . Key == "unittests.plugin" ) ) ;
62+
63+ repo . Config . Add ( "unittests.plugin" , "value1" , ConfigurationLevel . Local ) ;
64+ repo . Config . Add ( "unittests.plugin" , "value2" , ConfigurationLevel . Local ) ;
65+
66+ Assert . Equal ( new [ ] { "value1" , "value2" } , repo . Config
67+ . OfType < ConfigurationEntry < string > > ( )
68+ . Where ( x => x . Key == "unittests.plugin" && x . Level == ConfigurationLevel . Local )
69+ . Select ( x => x . Value )
70+ . ToArray ( ) ) ;
71+ }
72+ }
73+
74+ [ Fact ]
75+ public void CanAddAndReadMultivarFromTheGlobalConfiguration ( )
76+ {
77+ string path = SandboxBareTestRepo ( ) ;
78+ using ( var repo = new Repository ( path ) )
79+ {
80+ Assert . True ( repo . Config . HasConfig ( ConfigurationLevel . Global ) ) ;
81+ Assert . Empty ( repo . Config
82+ . OfType < ConfigurationEntry < string > > ( )
83+ . Where ( x => x . Key == "unittests.plugin" ) ) ;
84+
85+ repo . Config . Add ( "unittests.plugin" , "value1" , ConfigurationLevel . Global ) ;
86+ repo . Config . Add ( "unittests.plugin" , "value2" , ConfigurationLevel . Global ) ;
87+
88+ Assert . Equal ( new [ ] { "value1" , "value2" } , repo . Config
89+ . OfType < ConfigurationEntry < string > > ( )
90+ . Where ( x => x . Key == "unittests.plugin" )
91+ . Select ( x => x . Value )
92+ . ToArray ( ) ) ;
93+ }
94+ }
95+
96+ [ Fact ]
97+ public void CanUnsetAllFromTheGlobalConfiguration ( )
98+ {
99+ string path = SandboxBareTestRepo ( ) ;
100+ using ( var repo = new Repository ( path ) )
101+ {
102+ Assert . True ( repo . Config . HasConfig ( ConfigurationLevel . Global ) ) ;
103+ Assert . Empty ( repo . Config
104+ . OfType < ConfigurationEntry < string > > ( )
105+ . Where ( x => x . Key == "unittests.plugin" )
106+ . Select ( x => x . Value )
107+ . ToArray ( ) ) ;
108+
109+ repo . Config . Add ( "unittests.plugin" , "value1" , ConfigurationLevel . Global ) ;
110+ repo . Config . Add ( "unittests.plugin" , "value2" , ConfigurationLevel . Global ) ;
111+
112+ Assert . Equal ( 2 , repo . Config
113+ . OfType < ConfigurationEntry < string > > ( )
114+ . Where ( x => x . Key == "unittests.plugin" && x . Level == ConfigurationLevel . Global )
115+ . Select ( x => x . Value )
116+ . Count ( ) ) ;
117+
118+ repo . Config . UnsetAll ( "unittests.plugin" ) ;
119+
120+ Assert . Equal ( 2 , repo . Config
121+ . OfType < ConfigurationEntry < string > > ( )
122+ . Where ( x => x . Key == "unittests.plugin" && x . Level == ConfigurationLevel . Global )
123+ . Select ( x => x . Value )
124+ . Count ( ) ) ;
125+
126+ repo . Config . UnsetAll ( "unittests.plugin" , ConfigurationLevel . Global ) ;
127+
128+ Assert . Empty ( repo . Config
129+ . OfType < ConfigurationEntry < string > > ( )
130+ . Where ( x => x . Key == "unittests.plugin" )
131+ . Select ( x => x . Value )
132+ . ToArray ( ) ) ;
133+ }
134+ }
135+
136+ [ Fact ]
137+ public void CanUnsetAllFromTheLocalConfiguration ( )
138+ {
139+ string path = SandboxStandardTestRepo ( ) ;
140+ using ( var repo = new Repository ( path ) )
141+ {
142+ Assert . True ( repo . Config . HasConfig ( ConfigurationLevel . Global ) ) ;
143+ Assert . Empty ( repo . Config
144+ . OfType < ConfigurationEntry < string > > ( )
145+ . Where ( x => x . Key == "unittests.plugin" )
146+ . Select ( x => x . Value )
147+ . ToArray ( ) ) ;
148+
149+ repo . Config . Add ( "unittests.plugin" , "value1" ) ;
150+ repo . Config . Add ( "unittests.plugin" , "value2" ) ;
151+
152+ Assert . Equal ( 2 , repo . Config
153+ . OfType < ConfigurationEntry < string > > ( )
154+ . Where ( x => x . Key == "unittests.plugin" && x . Level == ConfigurationLevel . Local )
155+ . Select ( x => x . Value )
156+ . Count ( ) ) ;
157+
158+ repo . Config . UnsetAll ( "unittests.plugin" ) ;
159+
160+ Assert . Empty ( repo . Config
161+ . OfType < ConfigurationEntry < string > > ( )
162+ . Where ( x => x . Key == "unittests.plugin" ) ) ;
163+ }
164+ }
165+
53166 [ Fact ]
54167 public void CanReadBooleanValue ( )
55168 {
0 commit comments