@@ -28,18 +28,17 @@ public sealed class WebDeleteTest : TaskTest
2828 [ Test ]
2929 public void Execute ( )
3030 {
31- var fileToUpload = Assembly . GetExecutingAssembly ( ) . LocalFilePath ( ) ;
31+ var fileToDelete = Assembly . GetExecutingAssembly ( ) . LocalFilePath ( ) ;
3232
3333 var targetUri = "http://www.example.com/mypath" ;
3434
3535 var webClient = new Mock < IInternalWebClient > ( ) ;
3636 {
37- webClient . Setup ( w => w . UploadFile ( It . IsAny < Uri > ( ) , It . IsAny < string > ( ) , It . IsAny < string > ( ) ) )
38- . Callback < Uri , string , string > (
39- ( uri , method , path ) =>
37+ webClient . Setup ( w => w . DeleteFile ( It . IsAny < Uri > ( ) ) )
38+ . Callback < Uri > (
39+ ( uri ) =>
4040 {
41- Assert . AreEqual ( new Uri ( targetUri + "/" + Path . GetFileName ( path ) ) , uri ) ;
42- Assert . AreEqual ( fileToUpload , path ) ;
41+ Assert . AreEqual ( new Uri ( targetUri + "/" + Path . GetFileName ( fileToDelete ) ) , uri ) ;
4342 } )
4443 . Returns ( new byte [ 0 ] )
4544 . Verifiable ( ) ;
@@ -51,26 +50,26 @@ public void Execute()
5150
5251 var task = new WebDelete ( builder ) ;
5352 task . BuildEngine = BuildEngine . Object ;
54- task . Items = new ITaskItem [ ] { new TaskItem ( fileToUpload ) } ;
53+ task . Items = new ITaskItem [ ] { new TaskItem ( fileToDelete ) } ;
5554 task . Source = new TaskItem ( targetUri ) ;
5655 task . UseDefaultCredentials = false ;
5756
5857 var result = task . Execute ( ) ;
5958 Assert . IsTrue ( result , "Expected the task to finish successfully" ) ;
6059
61- webClient . Verify ( w => w . UploadFile ( It . IsAny < Uri > ( ) , It . IsAny < string > ( ) , It . IsAny < string > ( ) ) , Times . Once ( ) ) ;
60+ webClient . Verify ( w => w . DeleteFile ( It . IsAny < Uri > ( ) ) , Times . Once ( ) ) ;
6261
6362 VerifyNumberOfLogMessages ( numberOfErrorMessages : 0 , numberOfWarningMessages : 0 , numberOfNormalMessages : 3 ) ;
6463 }
6564
6665 [ Test ]
6766 public void ExecuteWithEmptyUrl ( )
6867 {
69- var fileToUpload = Assembly . GetExecutingAssembly ( ) . LocalFilePath ( ) ;
68+ var fileToDelete = Assembly . GetExecutingAssembly ( ) . LocalFilePath ( ) ;
7069
7170 var webClient = new Mock < IInternalWebClient > ( ) ;
7271 {
73- webClient . Setup ( w => w . UploadFile ( It . IsAny < Uri > ( ) , It . IsAny < string > ( ) , It . IsAny < string > ( ) ) )
72+ webClient . Setup ( w => w . DeleteFile ( It . IsAny < Uri > ( ) ) )
7473 . Verifiable ( ) ;
7574 }
7675
@@ -80,14 +79,14 @@ public void ExecuteWithEmptyUrl()
8079
8180 var task = new WebDelete ( builder ) ;
8281 task . BuildEngine = BuildEngine . Object ;
83- task . Items = new ITaskItem [ ] { new TaskItem ( fileToUpload ) } ;
82+ task . Items = new ITaskItem [ ] { new TaskItem ( fileToDelete ) } ;
8483 task . Source = new TaskItem ( string . Empty ) ;
8584 task . UseDefaultCredentials = false ;
8685
8786 var result = task . Execute ( ) ;
8887 Assert . IsFalse ( result , "Expected the task to not finish successfully" ) ;
8988
90- webClient . Verify ( w => w . UploadFile ( It . IsAny < Uri > ( ) , It . IsAny < string > ( ) , It . IsAny < string > ( ) ) , Times . Never ( ) ) ;
89+ webClient . Verify ( w => w . DeleteFile ( It . IsAny < Uri > ( ) ) , Times . Never ( ) ) ;
9190
9291 VerifyNumberOfLogMessages ( numberOfErrorMessages : 1 , numberOfWarningMessages : 0 , numberOfNormalMessages : 0 ) ;
9392 }
@@ -99,7 +98,7 @@ public void ExecuteWithInvalidUrl()
9998
10099 var webClient = new Mock < IInternalWebClient > ( ) ;
101100 {
102- webClient . Setup ( w => w . UploadFile ( It . IsAny < Uri > ( ) , It . IsAny < string > ( ) , It . IsAny < string > ( ) ) )
101+ webClient . Setup ( w => w . DeleteFile ( It . IsAny < Uri > ( ) ) )
103102 . Verifiable ( ) ;
104103 }
105104
@@ -116,7 +115,7 @@ public void ExecuteWithInvalidUrl()
116115 var result = task . Execute ( ) ;
117116 Assert . IsFalse ( result , "Expected the task to not finish successfully" ) ;
118117
119- webClient . Verify ( w => w . UploadFile ( It . IsAny < Uri > ( ) , It . IsAny < string > ( ) , It . IsAny < string > ( ) ) , Times . Never ( ) ) ;
118+ webClient . Verify ( w => w . DeleteFile ( It . IsAny < Uri > ( ) ) , Times . Never ( ) ) ;
120119
121120 VerifyNumberOfLogMessages ( numberOfErrorMessages : 1 , numberOfWarningMessages : 0 , numberOfNormalMessages : 0 ) ;
122121 }
@@ -126,7 +125,7 @@ public void ExecuteWithoutItems()
126125 {
127126 var webClient = new Mock < IInternalWebClient > ( ) ;
128127 {
129- webClient . Setup ( w => w . UploadFile ( It . IsAny < Uri > ( ) , It . IsAny < string > ( ) , It . IsAny < string > ( ) ) )
128+ webClient . Setup ( w => w . DeleteFile ( It . IsAny < Uri > ( ) ) )
130129 . Verifiable ( ) ;
131130 }
132131
@@ -143,7 +142,7 @@ public void ExecuteWithoutItems()
143142 var result = task . Execute ( ) ;
144143 Assert . IsFalse ( result , "Expected the task to not finish successfully" ) ;
145144
146- webClient . Verify ( w => w . UploadFile ( It . IsAny < Uri > ( ) , It . IsAny < string > ( ) , It . IsAny < string > ( ) ) , Times . Never ( ) ) ;
145+ webClient . Verify ( w => w . DeleteFile ( It . IsAny < Uri > ( ) ) , Times . Never ( ) ) ;
147146
148147 VerifyNumberOfLogMessages ( numberOfErrorMessages : 1 , numberOfWarningMessages : 0 , numberOfNormalMessages : 0 ) ;
149148 }
@@ -155,7 +154,7 @@ public void ExecuteWithoutUrl()
155154
156155 var webClient = new Mock < IInternalWebClient > ( ) ;
157156 {
158- webClient . Setup ( w => w . UploadFile ( It . IsAny < Uri > ( ) , It . IsAny < string > ( ) , It . IsAny < string > ( ) ) )
157+ webClient . Setup ( w => w . DeleteFile ( It . IsAny < Uri > ( ) ) )
159158 . Verifiable ( ) ;
160159 }
161160
@@ -171,7 +170,7 @@ public void ExecuteWithoutUrl()
171170 var result = task . Execute ( ) ;
172171 Assert . IsFalse ( result , "Expected the task to not finish successfully" ) ;
173172
174- webClient . Verify ( w => w . UploadFile ( It . IsAny < Uri > ( ) , It . IsAny < string > ( ) , It . IsAny < string > ( ) ) , Times . Never ( ) ) ;
173+ webClient . Verify ( w => w . DeleteFile ( It . IsAny < Uri > ( ) ) , Times . Never ( ) ) ;
175174
176175 VerifyNumberOfLogMessages ( numberOfErrorMessages : 1 , numberOfWarningMessages : 0 , numberOfNormalMessages : 0 ) ;
177176 }
0 commit comments