11using System ;
22using System . Collections . Generic ;
3+ using System . Linq ;
34using Cake . Core ;
45
56namespace Cake . Xamarin . Tests . Fakes
67{
78 internal sealed class FakeCakeArguments : ICakeArguments
89 {
9- private readonly Dictionary < string , string > _arguments ;
10+ private readonly Dictionary < string , List < string > > _arguments ;
1011
1112 /// <summary>
1213 /// Gets the arguments.
1314 /// </summary>
1415 /// <value>The arguments.</value>
15- public IReadOnlyDictionary < string , string > Arguments
16- {
17- get { return _arguments ; }
18- }
16+ public IReadOnlyDictionary < string , List < string > > Arguments => _arguments ;
1917
2018 /// <summary>
2119 /// Initializes a new instance of the <see cref="CakeArguments"/> class.
2220 /// </summary>
2321 public FakeCakeArguments ( )
2422 {
25- _arguments = new Dictionary < string , string > ( StringComparer . OrdinalIgnoreCase ) ;
23+ _arguments = new Dictionary < string , List < string > > ( StringComparer . OrdinalIgnoreCase ) ;
2624 }
2725
2826 /// <summary>
2927 /// Initializes the argument list.
3028 /// </summary>
3129 /// <param name="arguments">The arguments.</param>
32- public void SetArguments ( IDictionary < string , string > arguments )
30+ public void SetArguments ( IDictionary < string , List < string > > arguments )
3331 {
3432 if ( arguments == null )
3533 {
36- throw new ArgumentNullException ( " arguments" ) ;
34+ throw new ArgumentNullException ( nameof ( arguments ) ) ;
3735 }
3836 _arguments . Clear ( ) ;
3937 foreach ( var argument in arguments )
@@ -54,15 +52,20 @@ public bool HasArgument(string name)
5452 return _arguments . ContainsKey ( name ) ;
5553 }
5654
55+ public ICollection < string > GetArguments ( string name )
56+ {
57+ _arguments . TryGetValue ( name , out var arguments ) ;
58+ return arguments ?? ( ICollection < string > ) Array . Empty < string > ( ) ;
59+ }
60+
5761 /// <summary>
5862 /// Gets an argument.
5963 /// </summary>
6064 /// <param name="name">The argument name.</param>
6165 /// <returns>The argument value.</returns>
6266 public string GetArgument ( string name )
6367 {
64- return _arguments . ContainsKey ( name )
65- ? _arguments [ name ] : null ;
68+ return GetArguments ( name ) . LastOrDefault ( ) ;
6669 }
6770 }
6871}
0 commit comments