@@ -32,12 +32,17 @@ public class TyposquattingCheckServiceFacts
3232
3333 private static Mock < ITyposquattingUserService > _typosquattingUserService = new Mock < ITyposquattingUserService > ( ) ;
3434 private static Mock < IEntityRepository < PackageRegistration > > _packageRegistrationRepository = new Mock < IEntityRepository < PackageRegistration > > ( ) ;
35+ private static Mock < IContentObjectService > _contentObjectService = new Mock < IContentObjectService > ( ) ;
3536
3637 public TyposquattingCheckServiceFacts ( )
3738 {
3839 _packageRegistrationRepository
3940 . Setup ( x => x . GetAll ( ) )
4041 . Returns ( _pacakgeRegistrationsList . AsQueryable ( ) ) ;
42+
43+ _contentObjectService
44+ . Setup ( x => x . TyposquattingConfiguration . PackageIdChecklistLength )
45+ . Returns ( 20000 ) ;
4146 }
4247
4348 [ Fact ]
@@ -51,7 +56,7 @@ public void CheckNotTyposquattingByDifferentOwnersTest()
5156 . Setup ( x => x . CanUserTyposquat ( It . IsAny < string > ( ) , It . IsAny < string > ( ) ) )
5257 . Returns ( false ) ;
5358
54- var newService = new TyposquattingCheckService ( _typosquattingUserService . Object , _packageRegistrationRepository . Object ) ;
59+ var newService = new TyposquattingCheckService ( _typosquattingUserService . Object , _packageRegistrationRepository . Object , _contentObjectService . Object ) ;
5560
5661 // Act
5762 var typosquattingCheckResult = newService . IsUploadedPackageIdTyposquatting ( uploadedPackageId , uploadedPackageOwner ) ;
@@ -72,7 +77,7 @@ public void CheckNotTyposquattingBySameOwnersTest()
7277 . Setup ( x => x . CanUserTyposquat ( It . IsAny < string > ( ) , It . IsAny < string > ( ) ) )
7378 . Returns ( true ) ;
7479
75- var newService = new TyposquattingCheckService ( _typosquattingUserService . Object , _packageRegistrationRepository . Object ) ;
80+ var newService = new TyposquattingCheckService ( _typosquattingUserService . Object , _packageRegistrationRepository . Object , _contentObjectService . Object ) ;
7681
7782 // Act
7883 var typosquattingCheckResult = newService . IsUploadedPackageIdTyposquatting ( uploadedPackageId , uploadedPackageOwner ) ;
@@ -92,7 +97,7 @@ public void CheckTyposquattingByDifferentOwnersTest()
9297 . Setup ( x => x . CanUserTyposquat ( It . IsAny < string > ( ) , It . IsAny < string > ( ) ) )
9398 . Returns ( false ) ;
9499
95- var newService = new TyposquattingCheckService ( _typosquattingUserService . Object , _packageRegistrationRepository . Object ) ;
100+ var newService = new TyposquattingCheckService ( _typosquattingUserService . Object , _packageRegistrationRepository . Object , _contentObjectService . Object ) ;
96101
97102 // Act
98103 var typosquattingCheckResult = newService . IsUploadedPackageIdTyposquatting ( uploadedPackageId , uploadedPackageOwner ) ;
@@ -108,7 +113,7 @@ public void CheckTyposquattingNullUploadedPackageId()
108113 var uploadedPackageOwner = new User ( ) ;
109114 string uploadedPackageId = null ;
110115
111- var newService = new TyposquattingCheckService ( _typosquattingUserService . Object , _packageRegistrationRepository . Object ) ;
116+ var newService = new TyposquattingCheckService ( _typosquattingUserService . Object , _packageRegistrationRepository . Object , _contentObjectService . Object ) ;
112117
113118 // Act
114119 var exception = Assert . Throws < ArgumentNullException > (
@@ -125,7 +130,7 @@ public void CheckTyposquattingNullUploadedPackageOwner()
125130 User uploadedPackageOwner = null ;
126131 var uploadedPackageId = "microsoft_netframework_v1" ;
127132
128- var newService = new TyposquattingCheckService ( _typosquattingUserService . Object , _packageRegistrationRepository . Object ) ;
133+ var newService = new TyposquattingCheckService ( _typosquattingUserService . Object , _packageRegistrationRepository . Object , _contentObjectService . Object ) ;
129134
130135 // Act
131136 var exception = Assert . Throws < ArgumentNullException > (
@@ -142,7 +147,7 @@ public void CheckTyposquattingEmptyUploadedPackageId()
142147 var uploadedPackageOwner = new User ( ) ;
143148 var uploadedPackageId = "" ;
144149
145- var newService = new TyposquattingCheckService ( _typosquattingUserService . Object , _packageRegistrationRepository . Object ) ;
150+ var newService = new TyposquattingCheckService ( _typosquattingUserService . Object , _packageRegistrationRepository . Object , _contentObjectService . Object ) ;
146151
147152 // Act
148153 var typosquattingCheckResult = newService . IsUploadedPackageIdTyposquatting ( uploadedPackageId , uploadedPackageOwner ) ;
@@ -165,7 +170,7 @@ public void CheckTyposquattingEmptyChecklist()
165170 . Setup ( x => x . GetAll ( ) )
166171 . Returns ( new List < PackageRegistration > ( ) . AsQueryable ( ) ) ;
167172
168- var newService = new TyposquattingCheckService ( _typosquattingUserService . Object , _packageRegistrationRepository . Object ) ;
173+ var newService = new TyposquattingCheckService ( _typosquattingUserService . Object , _packageRegistrationRepository . Object , _contentObjectService . Object ) ;
169174
170175 // Act
171176 var typosquattingCheckResult = newService . IsUploadedPackageIdTyposquatting ( uploadedPackageId , uploadedPackageOwner ) ;
0 commit comments