@@ -20,7 +20,7 @@ public static void Setup(TestContext testContext)
20
20
TestHost = "https://www.ashleypoole.co.uk" ;
21
21
var webResponseModel = new WebResponseModel ( )
22
22
{
23
- Payloay = "{\" host\" :\" www.ashleypoole.co.uk\" ,\" port\" :443,\" protocol\" :\" HTTPS\" ,\" isPublic\" :true,\" status\" :\" READY\" ,\" " +
23
+ Payloay = "{\" host\" :\" https:// www.ashleypoole.co.uk\" ,\" port\" :443,\" protocol\" :\" HTTPS\" ,\" isPublic\" :true,\" status\" :\" READY\" ,\" " +
24
24
"startTime\" :1422115006431,\" testTime\" :1422115131804,\" engineVersion\" :\" 1.12.8\" ,\" criteriaVersion\" :\" 2009i\" ,\" " +
25
25
"endpoints\" :[{\" ipAddress\" :\" 104.28.6.2\" ,\" statusMessage\" :\" Ready\" ,\" grade\" :\" A\" ,\" hasWarnings\" :false,\" " +
26
26
"isExceptional\" :false,\" progress\" :100,\" duration\" :64286,\" eta\" :2393,\" delegation\" :3},{\" ipAddress\" :\" 104.28.7.2\" " +
@@ -54,7 +54,7 @@ public static void Setup(TestContext testContext)
54
54
TestHost = "https://www.ashleypoole.co.uk" ;
55
55
var webResponseModel = new WebResponseModel ( )
56
56
{
57
- Payloay = "{\" host\" :\" www.ashleypoole.co.uk\" ,\" port\" :443,\" protocol\" :\" HTTP\" ,\" isPublic\" :false,\" status\" :\" DNS\" " +
57
+ Payloay = "{\" host\" :\" https:// www.ashleypoole.co.uk\" ,\" port\" :443,\" protocol\" :\" HTTP\" ,\" isPublic\" :false,\" status\" :\" DNS\" " +
58
58
",\" statusMessage\" :\" Resolving domain names\" ,\" startTime\" :1422475200798,\" engineVersion\" :\" 1.12.8\" ," +
59
59
"\" criteriaVersion\" :\" 2009i\" }" ,
60
60
StatusCode = 200 ,
@@ -85,14 +85,14 @@ public static void Setup(TestContext testContext)
85
85
TestHost = "https://www.ashleypoole.co.uk" ;
86
86
var webResponseModel = new WebResponseModel ( )
87
87
{
88
- Payloay = "{\" host\" :\" www.ashleypoole.co.uk\" ,\" port\" :443,\" protocol\" :\" HTTP\" ,\" isPublic\" :false ,\" " +
88
+ Payloay = "{\" host\" :\" https:// www.ashleypoole.co.uk\" ,\" port\" :443,\" protocol\" :\" HTTP\" ,\" isPublic\" :true ,\" " +
89
89
"status\" :\" IN_PROGRESS\" ,\" startTime\" :1422479488403,\" engineVersion\" :\" 1.12.8\" ,\" criteriaVersion\" :\" 2009i\" " +
90
90
",\" endpoints\" :[{\" ipAddress\" :\" 104.28.6.2\" ,\" statusMessage\" :\" In progress\" ,\" statusDetails\" :\" TESTING_HTTPS\" " +
91
91
",\" statusDetailsMessage\" :\" Sending one complete HTTPS request\" ,\" progress\" :-1,\" eta\" :-1,\" delegation\" :3}," +
92
92
"{\" ipAddress\" :\" 104.28.7.2\" ,\" statusMessage\" :\" Pending\" ,\" progress\" :-1,\" eta\" :-1,\" delegation\" :3}]}" ,
93
93
StatusCode = 200 ,
94
94
StatusDescription = "Ok" ,
95
- Url = ( "https://api.dev.ssllabs.com/api/fa78d5a4/analyze?host=" + TestHost + "&publish=on&clearCache=on& all=done" )
95
+ Url = ( "https://api.dev.ssllabs.com/api/fa78d5a4/analyze?host=" + TestHost + "&publish=on&all=done" )
96
96
} ;
97
97
98
98
mockedApiProvider . Setup ( x => x . MakeGetRequest ( It . IsAny < RequestModel > ( ) ) ) . Returns ( webResponseModel ) ;
@@ -116,14 +116,14 @@ public class when_a_invalid_request_is_made_with_all_the_inputs_and_the_scan_is_
116
116
public static void Setup ( TestContext testContext )
117
117
{
118
118
var mockedApiProvider = new Mock < IApiProvider > ( ) ;
119
- TestHost = "https://www .ashleypoole.co.uk" ;
119
+ TestHost = "https://www2 .ashleypoole.co.uk" ;
120
120
var webResponseModel = new WebResponseModel ( )
121
121
{
122
- Payloay = "{\" host\" :\" www2.ashleypoole.co.uk\" ,\" port\" :443,\" protocol\" :\" HTTP\" ,\" isPublic\" :false,\" status\" :\" ERROR\" ," +
122
+ Payloay = "{\" host\" :\" https:// www2.ashleypoole.co.uk\" ,\" port\" :443,\" protocol\" :\" HTTP\" ,\" isPublic\" :false,\" status\" :\" ERROR\" ," +
123
123
"\" statusMessage\" :\" Unable to resolve domain name\" ,\" startTime\" :1422478797953,\" testTime\" :1422478798017," +
124
124
"\" engineVersion\" :\" 1.12.8\" ,\" criteriaVersion\" :\" 2009i\" ,\" cacheExpiryTime\" :1422478858017}" ,
125
- StatusCode = 500 ,
126
- StatusDescription = "Bad Request " ,
125
+ StatusCode = 200 ,
126
+ StatusDescription = "Ok " ,
127
127
Url = ( "https://api.dev.ssllabs.com/api/fa78d5a4/analyze?host=" + TestHost )
128
128
} ;
129
129
@@ -135,14 +135,38 @@ public static void Setup(TestContext testContext)
135
135
}
136
136
}
137
137
138
+ [ TestClass ]
139
+ public class when_a_invalid_request_is_made_with_both_clearCache_and_fromCache : NegativeTests
140
+ {
141
+ [ ClassInitialize ]
142
+ public static void Setup ( TestContext testContext )
143
+ {
144
+ var mockedApiProvider = new Mock < IApiProvider > ( ) ;
145
+ TestHost = "https://www.ashleypoole.co.uk" ;
146
+ var webResponseModel = new WebResponseModel ( )
147
+ {
148
+ Payloay = "{\" errors\" :[{\" message\" :\" Parameters \u0027 fromCache\u0027 and \u0027 clearCache\u0027 cannot be used at the same time\" }]}" ,
149
+ StatusCode = 400 ,
150
+ StatusDescription = "Ok" ,
151
+ Url = ( "https://api.dev.ssllabs.com/api/fa78d5a4/analyze?host=" + TestHost + "&clearCache=on&fromCache=on&all=done" )
152
+ } ;
153
+
154
+ mockedApiProvider . Setup ( x => x . MakeGetRequest ( It . IsAny < RequestModel > ( ) ) ) . Returns ( webResponseModel ) ;
155
+
156
+ var ssllService = new SSLLService ( "https://api.dev.ssllabs.com/api/fa78d5a4/" , mockedApiProvider . Object ) ;
157
+ Response = ssllService . Analyze ( TestHost , SSLLService . Publish . On , SSLLService . ClearCache . On ,
158
+ SSLLService . FromCache . Ignore , SSLLService . All . Done ) ;
159
+ }
160
+ }
161
+
138
162
public abstract class PositiveTests : GenericPositiveTests < Analyze >
139
163
{
140
164
public static string TestHost ;
141
165
142
166
[ TestMethod ]
143
167
public void then_the_host_property_should_match_the_requested_hostname ( )
144
168
{
145
- Response . host . Should ( ) . Be ( TestHost . Substring ( 8 ) ) ;
169
+ Response . host . Should ( ) . Be ( TestHost ) ;
146
170
}
147
171
148
172
[ TestMethod ]
0 commit comments