@@ -26,7 +26,8 @@ public class VcsServiceTests
2626 {
2727 private const string OWNER = "owner" ;
2828 private const string REPOSITORY = "repository" ;
29- private const int MILESTONE_NUMBER = 1 ;
29+ private const int MILESTONE_PUBLIC_NUMBER = 1 ;
30+ private const int MILESTONE_INTERNAL_NUMBER = 123 ;
3031 private const string MILESTONE_TITLE = "0.1.0" ;
3132 private const string TAG_NAME = "0.1.0" ;
3233 private const string RELEASE_NOTES = "Release Notes" ;
@@ -126,7 +127,7 @@ public async Task Should_Add_Assets()
126127 await _vcsService . AddAssetsAsync ( OWNER , REPOSITORY , TAG_NAME , _assets ) . ConfigureAwait ( false ) ;
127128
128129 await _vcsProvider . Received ( 1 ) . GetReleaseAsync ( OWNER , REPOSITORY , TAG_NAME ) . ConfigureAwait ( false ) ;
129- await _vcsProvider . DidNotReceive ( ) . DeleteAssetAsync ( OWNER , REPOSITORY , Arg . Any < int > ( ) ) . ConfigureAwait ( false ) ;
130+ await _vcsProvider . DidNotReceive ( ) . DeleteAssetAsync ( OWNER , REPOSITORY , Arg . Any < ReleaseAsset > ( ) ) . ConfigureAwait ( false ) ;
130131 await _vcsProvider . Received ( assetsCount ) . UploadAssetAsync ( release , Arg . Any < ReleaseAssetUpload > ( ) ) . ConfigureAwait ( false ) ;
131132
132133 _logger . DidNotReceive ( ) . Warning ( Arg . Any < string > ( ) , Arg . Any < string > ( ) ) ;
@@ -149,7 +150,7 @@ public async Task Should_Add_Assets_With_Deleting_Existing_Assets()
149150 await _vcsService . AddAssetsAsync ( OWNER , REPOSITORY , TAG_NAME , _assets ) . ConfigureAwait ( false ) ;
150151
151152 await _vcsProvider . Received ( 1 ) . GetReleaseAsync ( OWNER , REPOSITORY , TAG_NAME ) . ConfigureAwait ( false ) ;
152- await _vcsProvider . Received ( releaseAssetsCount ) . DeleteAssetAsync ( OWNER , REPOSITORY , releaseAsset . Id ) . ConfigureAwait ( false ) ;
153+ await _vcsProvider . Received ( releaseAssetsCount ) . DeleteAssetAsync ( OWNER , REPOSITORY , releaseAsset ) . ConfigureAwait ( false ) ;
153154 await _vcsProvider . Received ( assetsCount ) . UploadAssetAsync ( release , Arg . Any < ReleaseAssetUpload > ( ) ) . ConfigureAwait ( false ) ;
154155
155156 _logger . Received ( releaseAssetsCount ) . Warning ( Arg . Any < string > ( ) , Arg . Any < string > ( ) ) ;
@@ -172,7 +173,7 @@ public async Task Should_Throw_Exception_On_Adding_Assets_When_Asset_File_Not_Ex
172173 ex . Message . ShouldContain ( assetFilePath ) ;
173174
174175 await _vcsProvider . Received ( 1 ) . GetReleaseAsync ( OWNER , REPOSITORY , TAG_NAME ) . ConfigureAwait ( false ) ;
175- await _vcsProvider . DidNotReceive ( ) . DeleteAssetAsync ( OWNER , REPOSITORY , Arg . Any < int > ( ) ) . ConfigureAwait ( false ) ;
176+ await _vcsProvider . DidNotReceive ( ) . DeleteAssetAsync ( OWNER , REPOSITORY , Arg . Any < ReleaseAsset > ( ) ) . ConfigureAwait ( false ) ;
176177 await _vcsProvider . DidNotReceive ( ) . UploadAssetAsync ( release , Arg . Any < ReleaseAssetUpload > ( ) ) . ConfigureAwait ( false ) ;
177178 }
178179
@@ -182,7 +183,7 @@ public async Task Should_Do_Nothing_On_Missing_Assets(IList<string> assets)
182183 await _vcsService . AddAssetsAsync ( OWNER , REPOSITORY , TAG_NAME , assets ) . ConfigureAwait ( false ) ;
183184
184185 await _vcsProvider . DidNotReceive ( ) . GetReleaseAsync ( OWNER , REPOSITORY , TAG_NAME ) . ConfigureAwait ( false ) ;
185- await _vcsProvider . DidNotReceive ( ) . DeleteAssetAsync ( OWNER , REPOSITORY , Arg . Any < int > ( ) ) . ConfigureAwait ( false ) ;
186+ await _vcsProvider . DidNotReceive ( ) . DeleteAssetAsync ( OWNER , REPOSITORY , Arg . Any < ReleaseAsset > ( ) ) . ConfigureAwait ( false ) ;
186187 await _vcsProvider . DidNotReceive ( ) . UploadAssetAsync ( Arg . Any < Release > ( ) , Arg . Any < ReleaseAssetUpload > ( ) ) . ConfigureAwait ( false ) ;
187188 }
188189
@@ -205,7 +206,7 @@ public async Task Should_Create_Labels()
205206 _vcsProvider . GetLabelsAsync ( OWNER , REPOSITORY )
206207 . Returns ( Task . FromResult ( ( IEnumerable < Label > ) labels ) ) ;
207208
208- _vcsProvider . DeleteLabelAsync ( OWNER , REPOSITORY , Arg . Any < string > ( ) )
209+ _vcsProvider . DeleteLabelAsync ( OWNER , REPOSITORY , Arg . Any < Label > ( ) )
209210 . Returns ( Task . CompletedTask ) ;
210211
211212 _vcsProvider . CreateLabelAsync ( OWNER , REPOSITORY , Arg . Any < Label > ( ) )
@@ -214,7 +215,7 @@ public async Task Should_Create_Labels()
214215 await _vcsService . CreateLabelsAsync ( OWNER , REPOSITORY ) . ConfigureAwait ( false ) ;
215216
216217 await _vcsProvider . Received ( 1 ) . GetLabelsAsync ( OWNER , REPOSITORY ) . ConfigureAwait ( false ) ;
217- await _vcsProvider . Received ( labels . Count ) . DeleteLabelAsync ( OWNER , REPOSITORY , Arg . Any < string > ( ) ) . ConfigureAwait ( false ) ;
218+ await _vcsProvider . Received ( labels . Count ) . DeleteLabelAsync ( OWNER , REPOSITORY , Arg . Any < Label > ( ) ) . ConfigureAwait ( false ) ;
218219 await _vcsProvider . Received ( _configuration . Labels . Count ) . CreateLabelAsync ( OWNER , REPOSITORY , Arg . Any < Label > ( ) ) . ConfigureAwait ( false ) ;
219220
220221 _logger . Received ( 1 ) . Verbose ( Arg . Any < string > ( ) , OWNER , REPOSITORY ) ;
@@ -235,61 +236,65 @@ public async Task Should_Log_An_Warning_When_Labels_Not_Configured()
235236 [ Test ]
236237 public async Task Should_Close_Milestone ( )
237238 {
238- var milestone = new Milestone { Number = MILESTONE_NUMBER } ;
239+ var milestone = new Milestone { PublicNumber = MILESTONE_PUBLIC_NUMBER , InternalNumber = MILESTONE_INTERNAL_NUMBER } ;
239240
240241 _vcsProvider . GetMilestoneAsync ( OWNER , REPOSITORY , MILESTONE_TITLE , ItemStateFilter . Open )
241242 . Returns ( Task . FromResult ( milestone ) ) ;
242243
243- _vcsProvider . SetMilestoneStateAsync ( OWNER , REPOSITORY , milestone . Number , ItemState . Closed )
244+ _vcsProvider . SetMilestoneStateAsync ( OWNER , REPOSITORY , milestone , ItemState . Closed )
244245 . Returns ( Task . CompletedTask ) ;
245246
246247 await _vcsService . CloseMilestoneAsync ( OWNER , REPOSITORY , MILESTONE_TITLE ) . ConfigureAwait ( false ) ;
247248
248249 await _vcsProvider . Received ( 1 ) . GetMilestoneAsync ( OWNER , REPOSITORY , MILESTONE_TITLE , ItemStateFilter . Open ) . ConfigureAwait ( false ) ;
249- await _vcsProvider . Received ( 1 ) . SetMilestoneStateAsync ( OWNER , REPOSITORY , milestone . Number , ItemState . Closed ) . ConfigureAwait ( false ) ;
250+ await _vcsProvider . Received ( 1 ) . SetMilestoneStateAsync ( OWNER , REPOSITORY , milestone , ItemState . Closed ) . ConfigureAwait ( false ) ;
250251 }
251252
252253 [ Test ]
253254 public async Task Should_Log_An_Warning_On_Closing_When_Milestone_Cannot_Be_Found ( )
254255 {
256+ var milestone = new Milestone { PublicNumber = MILESTONE_PUBLIC_NUMBER , InternalNumber = MILESTONE_INTERNAL_NUMBER } ;
257+
255258 _vcsProvider . GetMilestoneAsync ( OWNER , REPOSITORY , MILESTONE_TITLE , ItemStateFilter . Open )
256259 . Returns ( Task . FromException < Milestone > ( _notFoundException ) ) ;
257260
258261 await _vcsService . CloseMilestoneAsync ( OWNER , REPOSITORY , MILESTONE_TITLE ) . ConfigureAwait ( false ) ;
259262
260263 await _vcsProvider . Received ( 1 ) . GetMilestoneAsync ( OWNER , REPOSITORY , MILESTONE_TITLE , ItemStateFilter . Open ) . ConfigureAwait ( false ) ;
261- await _vcsProvider . DidNotReceive ( ) . SetMilestoneStateAsync ( OWNER , REPOSITORY , MILESTONE_NUMBER , ItemState . Closed ) . ConfigureAwait ( false ) ;
264+ await _vcsProvider . DidNotReceive ( ) . SetMilestoneStateAsync ( OWNER , REPOSITORY , milestone , ItemState . Closed ) . ConfigureAwait ( false ) ;
262265 _logger . Received ( 1 ) . Warning ( UNABLE_TO_FOUND_MILESTONE_MESSAGE , "open" , MILESTONE_TITLE , OWNER , REPOSITORY ) ;
263266 }
264267
265268 [ Test ]
266269 public async Task Should_Open_Milestone ( )
267270 {
268- var milestone = new Milestone { Number = MILESTONE_NUMBER } ;
271+ var milestone = new Milestone { PublicNumber = MILESTONE_PUBLIC_NUMBER , InternalNumber = MILESTONE_INTERNAL_NUMBER } ;
269272
270273 _vcsProvider . GetMilestoneAsync ( OWNER , REPOSITORY , MILESTONE_TITLE , ItemStateFilter . Closed )
271274 . Returns ( Task . FromResult ( milestone ) ) ;
272275
273- _vcsProvider . SetMilestoneStateAsync ( OWNER , REPOSITORY , milestone . Number , ItemState . Open )
276+ _vcsProvider . SetMilestoneStateAsync ( OWNER , REPOSITORY , milestone , ItemState . Open )
274277 . Returns ( Task . CompletedTask ) ;
275278
276279 await _vcsService . OpenMilestoneAsync ( OWNER , REPOSITORY , MILESTONE_TITLE ) . ConfigureAwait ( false ) ;
277280
278281 await _vcsProvider . Received ( 1 ) . GetMilestoneAsync ( OWNER , REPOSITORY , MILESTONE_TITLE , ItemStateFilter . Closed ) . ConfigureAwait ( false ) ;
279- await _vcsProvider . Received ( 1 ) . SetMilestoneStateAsync ( OWNER , REPOSITORY , milestone . Number , ItemState . Open ) . ConfigureAwait ( false ) ;
282+ await _vcsProvider . Received ( 1 ) . SetMilestoneStateAsync ( OWNER , REPOSITORY , milestone , ItemState . Open ) . ConfigureAwait ( false ) ;
280283 _logger . Received ( 2 ) . Verbose ( Arg . Any < string > ( ) , MILESTONE_TITLE , OWNER , REPOSITORY ) ;
281284 }
282285
283286 [ Test ]
284287 public async Task Should_Log_An_Warning_On_Opening_When_Milestone_Cannot_Be_Found ( )
285288 {
289+ var milestone = new Milestone { PublicNumber = MILESTONE_PUBLIC_NUMBER , InternalNumber = MILESTONE_INTERNAL_NUMBER } ;
290+
286291 _vcsProvider . GetMilestoneAsync ( OWNER , REPOSITORY , MILESTONE_TITLE , ItemStateFilter . Closed )
287292 . Returns ( Task . FromException < Milestone > ( _notFoundException ) ) ;
288293
289294 await _vcsService . OpenMilestoneAsync ( OWNER , REPOSITORY , MILESTONE_TITLE ) . ConfigureAwait ( false ) ;
290295
291296 await _vcsProvider . Received ( 1 ) . GetMilestoneAsync ( OWNER , REPOSITORY , MILESTONE_TITLE , ItemStateFilter . Closed ) . ConfigureAwait ( false ) ;
292- await _vcsProvider . DidNotReceive ( ) . SetMilestoneStateAsync ( OWNER , REPOSITORY , MILESTONE_NUMBER , ItemState . Open ) . ConfigureAwait ( false ) ;
297+ await _vcsProvider . DidNotReceive ( ) . SetMilestoneStateAsync ( OWNER , REPOSITORY , milestone , ItemState . Open ) . ConfigureAwait ( false ) ;
293298 _logger . Received ( 1 ) . Warning ( UNABLE_TO_FOUND_MILESTONE_MESSAGE , "closed" , MILESTONE_TITLE , OWNER , REPOSITORY ) ;
294299 }
295300
@@ -556,13 +561,13 @@ public async Task Should_Delete_Draft_Release()
556561 _vcsProvider . GetReleaseAsync ( OWNER , REPOSITORY , TAG_NAME )
557562 . Returns ( Task . FromResult ( release ) ) ;
558563
559- _vcsProvider . DeleteReleaseAsync ( OWNER , REPOSITORY , release . Id )
564+ _vcsProvider . DeleteReleaseAsync ( OWNER , REPOSITORY , release )
560565 . Returns ( Task . CompletedTask ) ;
561566
562567 await _vcsService . DiscardReleaseAsync ( OWNER , REPOSITORY , TAG_NAME ) . ConfigureAwait ( false ) ;
563568
564569 await _vcsProvider . Received ( 1 ) . GetReleaseAsync ( OWNER , REPOSITORY , TAG_NAME ) . ConfigureAwait ( false ) ;
565- await _vcsProvider . Received ( 1 ) . DeleteReleaseAsync ( OWNER , REPOSITORY , release . Id ) . ConfigureAwait ( false ) ;
570+ await _vcsProvider . Received ( 1 ) . DeleteReleaseAsync ( OWNER , REPOSITORY , release ) . ConfigureAwait ( false ) ;
566571 }
567572
568573 [ Test ]
@@ -576,7 +581,7 @@ public async Task Should_Not_Delete_Published_Release()
576581 await _vcsService . DiscardReleaseAsync ( OWNER , REPOSITORY , TAG_NAME ) . ConfigureAwait ( false ) ;
577582
578583 await _vcsProvider . Received ( 1 ) . GetReleaseAsync ( OWNER , REPOSITORY , TAG_NAME ) . ConfigureAwait ( false ) ;
579- await _vcsProvider . DidNotReceive ( ) . DeleteReleaseAsync ( OWNER , REPOSITORY , release . Id ) . ConfigureAwait ( false ) ;
584+ await _vcsProvider . DidNotReceive ( ) . DeleteReleaseAsync ( OWNER , REPOSITORY , release ) . ConfigureAwait ( false ) ;
580585 _logger . Received ( 1 ) . Warning ( Arg . Any < string > ( ) , TAG_NAME ) ;
581586 }
582587
@@ -601,13 +606,13 @@ public async Task Should_Publish_Release()
601606 _vcsProvider . GetReleaseAsync ( OWNER , REPOSITORY , TAG_NAME )
602607 . Returns ( Task . FromResult ( release ) ) ;
603608
604- _vcsProvider . PublishReleaseAsync ( OWNER , REPOSITORY , TAG_NAME , release . Id )
609+ _vcsProvider . PublishReleaseAsync ( OWNER , REPOSITORY , TAG_NAME , release )
605610 . Returns ( Task . CompletedTask ) ;
606611
607612 await _vcsService . PublishReleaseAsync ( OWNER , REPOSITORY , TAG_NAME ) . ConfigureAwait ( false ) ;
608613
609614 await _vcsProvider . Received ( 1 ) . GetReleaseAsync ( OWNER , REPOSITORY , TAG_NAME ) . ConfigureAwait ( false ) ;
610- await _vcsProvider . Received ( 1 ) . PublishReleaseAsync ( OWNER , REPOSITORY , TAG_NAME , release . Id ) . ConfigureAwait ( false ) ;
615+ await _vcsProvider . Received ( 1 ) . PublishReleaseAsync ( OWNER , REPOSITORY , TAG_NAME , release ) . ConfigureAwait ( false ) ;
611616 _logger . Received ( 1 ) . Verbose ( Arg . Any < string > ( ) , TAG_NAME , OWNER , REPOSITORY ) ;
612617 _logger . Received ( 1 ) . Debug ( Arg . Any < string > ( ) , Arg . Any < Release > ( ) ) ;
613618 }
0 commit comments