Skip to content

Commit 146ad4d

Browse files
committed
Adding more unit tests
1 parent 9b5fb72 commit 146ad4d

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

SSLLWrapper.Tests/AnalyzeTests.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using FluentAssertions;
1+
using FluentAssertions;
32
using Microsoft.VisualStudio.TestTools.UnitTesting;
43
using Moq;
54
using SSLLWrapper;
@@ -20,7 +19,7 @@ public static void Setup(TestContext testContext)
2019
TestHost = "https://www.ashleypoole.co.uk";
2120
var webResponseModel = new WebResponseModel()
2221
{
23-
Payloay = "{\"host\":\"https://www.ashleypoole.co.uk\",\"port\":443,\"protocol\":\"HTTPS\",\"isPublic\":true,\"status\":\"READY\",\"" +
22+
Payloay = "{\"host\":\"https://www.ashleypoole.co.uk\",\"port\":443,\"protocol\":\"HTTPS\",\"isPublic\":false,\"status\":\"READY\",\"" +
2423
"startTime\":1422115006431,\"testTime\":1422115131804,\"engineVersion\":\"1.12.8\",\"criteriaVersion\":\"2009i\",\"" +
2524
"endpoints\":[{\"ipAddress\":\"104.28.6.2\",\"statusMessage\":\"Ready\",\"grade\":\"A\",\"hasWarnings\":false,\"" +
2625
"isExceptional\":false,\"progress\":100,\"duration\":64286,\"eta\":2393,\"delegation\":3},{\"ipAddress\":\"104.28.7.2\"" +
@@ -133,6 +132,12 @@ public static void Setup(TestContext testContext)
133132
Response = ssllService.Analyze(TestHost, SSLLService.Publish.On, SSLLService.ClearCache.On,
134133
SSLLService.FromCache.Ignore, SSLLService.All.Done);
135134
}
135+
136+
[TestMethod]
137+
public void then_the_status_code_should_be_valid_for_response()
138+
{
139+
Response.Header.statusCode.Should().Be(200);
140+
}
136141
}
137142

138143
[TestClass]
@@ -193,7 +198,7 @@ public void then_an_error_occurred_should_be_marked()
193198
}
194199

195200
[TestMethod]
196-
public void then_a_error_message_should_be_returned()
201+
public void then_at__least_one_error_should_be_thrown()
197202
{
198203
Response.Errors.Count.Should().BeGreaterOrEqualTo(1);
199204
}

SSLLWrapper.Tests/GenericNegativeTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class GenericNegativeTests<T> where T : IBaseResponse
99
public static T Response;
1010

1111
[TestMethod]
12-
public void then_the_error_count_should_be_greater_than_zero()
12+
public void then_at_least_one_error_should_be_thrown()
1313
{
1414
Response.Errors.Count.Should().BeGreaterOrEqualTo(1);
1515
}
@@ -21,7 +21,7 @@ public void then_the_HasErrorOccurred_should_be_true()
2121
}
2222

2323
[TestMethod]
24-
public void then_the_status_code_should_not_be_ok_200()
24+
public void then_the_status_code_should_be_valid_for_response()
2525
{
2626
Response.Header.statusCode.Should().NotBe(200);
2727
}

SSLLWrapper.Tests/InfoTests.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ public static void Setup(TestContext testContext)
5858
var mockedApiProvider = new Mock<IApiProvider>();
5959
var webResponseModel = new WebResponseModel()
6060
{
61-
Payloay = "",
62-
StatusCode = 400,
63-
StatusDescription = "Bad Request",
61+
Payloay = null,
62+
StatusCode = 0,
63+
StatusDescription = null,
6464
Url = "https://api.dev.ssllabs.com/api/fa78d5a4/info"
6565
};
6666

@@ -71,15 +71,9 @@ public static void Setup(TestContext testContext)
7171
}
7272

7373
[TestMethod]
74-
public void then_the_info_response_header_status_code_should_be_400()
75-
{
76-
Response.Header.statusCode.Should().Be(400);
77-
}
78-
79-
[TestMethod]
80-
public void then_the_info_response_header_status_description_should_match_api()
74+
public void then_the_info_response_header_status_code_should_indicate_failure()
8175
{
82-
Response.Header.statusDescription.Should().Be("Bad Request");
76+
Response.Header.statusCode.Should().Be(0);
8377
}
8478
}
8579

0 commit comments

Comments
 (0)