1+ using System . Linq ;
12using NUnit . Framework ;
23using SharpRepository . Repository ;
34using SharpRepository . Tests . Integration . TestAttributes ;
@@ -109,9 +110,70 @@ public void TryGet_Should_Return_True_If_Item_Exists(IRepository<Contact, string
109110 }
110111
111112 [ ExecuteForAllRepositories ]
112- public void TryGet_Should_Return_Falsel_If_Item_Does_Not_Exists ( IRepository < Contact , string > repository )
113+ public void TryGet_Should_Return_False_If_Item_Does_Not_Exists ( IRepository < Contact , string > repository )
113114 {
114115 repository . Exists ( string . Empty ) . ShouldBeFalse ( ) ;
115116 }
117+
118+ [ ExecuteForAllRepositories ]
119+ public void GetMany_Params_Should_Return_Multiple_Items ( IRepository < Contact , string > repository )
120+ {
121+ for ( var i = 1 ; i <= 5 ; i ++ )
122+ {
123+ var contact = new Contact { ContactId = i . ToString ( ) , Name = "Test User " + i } ;
124+ repository . Add ( contact ) ;
125+ }
126+
127+ var items = repository . GetMany ( "1" , "3" , "4" , "5" ) ;
128+ items . Count ( ) . ShouldEqual ( 4 ) ;
129+ }
130+
131+ [ ExecuteForAllRepositories ]
132+ public void GetMany_List_Should_Return_Multiple_Items ( IRepository < Contact , string > repository )
133+ {
134+ for ( var i = 1 ; i <= 5 ; i ++ )
135+ {
136+ var contact = new Contact { ContactId = i . ToString ( ) , Name = "Test User " + i } ;
137+ repository . Add ( contact ) ;
138+ }
139+
140+ var items = repository . GetMany ( new [ ] { "1" , "3" , "4" , "5" } . ToList ( ) ) ;
141+ items . Count ( ) . ShouldEqual ( 4 ) ;
142+ }
143+
144+ [ ExecuteForAllRepositories ]
145+ public void GetManyAsDictionary_Params_Should_Return_Multiple_Items ( IRepository < Contact , string > repository )
146+ {
147+ for ( var i = 1 ; i <= 5 ; i ++ )
148+ {
149+ var contact = new Contact { ContactId = i . ToString ( ) , Name = "Test User " + i } ;
150+ repository . Add ( contact ) ;
151+ }
152+
153+ var items = repository . GetManyAsDictionary ( "1" , "3" , "4" , "5" ) ;
154+ items . Count ( ) . ShouldEqual ( 4 ) ;
155+ items . ContainsKey ( "1" ) . ShouldBeTrue ( ) ;
156+ items . ContainsKey ( "2" ) . ShouldBeFalse ( ) ;
157+ items . ContainsKey ( "3" ) . ShouldBeTrue ( ) ;
158+ items . ContainsKey ( "4" ) . ShouldBeTrue ( ) ;
159+ items . ContainsKey ( "5" ) . ShouldBeTrue ( ) ;
160+ }
161+
162+ [ ExecuteForAllRepositories ]
163+ public void GetManyAsDictionary_List_Should_Return_Multiple_Items ( IRepository < Contact , string > repository )
164+ {
165+ for ( var i = 1 ; i <= 5 ; i ++ )
166+ {
167+ var contact = new Contact { ContactId = i . ToString ( ) , Name = "Test User " + i } ;
168+ repository . Add ( contact ) ;
169+ }
170+
171+ var items = repository . GetManyAsDictionary ( new [ ] { "1" , "3" , "4" , "5" } . ToList ( ) ) ;
172+ items . ContainsKey ( "1" ) . ShouldBeTrue ( ) ;
173+ items . ContainsKey ( "2" ) . ShouldBeFalse ( ) ;
174+ items . ContainsKey ( "3" ) . ShouldBeTrue ( ) ;
175+ items . ContainsKey ( "4" ) . ShouldBeTrue ( ) ;
176+ items . ContainsKey ( "5" ) . ShouldBeTrue ( ) ;
177+ }
116178 }
117179}
0 commit comments