Skip to content

Commit 34e0c24

Browse files
committed
Adding integration tests project in place of ConsoleAppTester
1 parent 7f78234 commit 34e0c24

File tree

15 files changed

+419
-167
lines changed

15 files changed

+419
-167
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ SSLLWrapper.Tests/obj/
1111
SSLLWrapper.Tests/bin/
1212
SSLLWrapper.ConsoleAppTester/bin/
1313
SSLLWrapper.ConsoleAppTester/obj/
14+
SSLLWrapper.IntegrationTests/obj/Release/
15+
SSLLWrapper.IntegrationTests/obj/Debug/
16+
SSLLWrapper.IntegrationTests/bin/Release/
17+
SSLLWrapper.IntegrationTests/bin/Debug/

SSLLWrapper.ConsoleAppTester/App.config

Lines changed: 0 additions & 6 deletions
This file was deleted.

SSLLWrapper.ConsoleAppTester/Program.cs

Lines changed: 0 additions & 64 deletions
This file was deleted.

SSLLWrapper.ConsoleAppTester/SSLLWrapper.ConsoleAppTester.csproj

Lines changed: 0 additions & 77 deletions
This file was deleted.

SSLLWrapper.ConsoleAppTester/packages.config

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
using System.Configuration;
2+
using FluentAssertions;
3+
using Microsoft.VisualStudio.TestTools.UnitTesting;
4+
using SSLLWrapper;
5+
using SSLLWrapper.Models.Response;
6+
7+
namespace given_that_I_make_a_analyze_request
8+
{
9+
[TestClass]
10+
public class when_i_expect_a_successful_result
11+
{
12+
private static SSLLService _ssllService;
13+
private static Analyze _analyze;
14+
private static string _host;
15+
16+
[ClassInitialize]
17+
public static void Setup(TestContext testContext)
18+
{
19+
_host = ConfigurationManager.AppSettings.Get("EndpointHost");
20+
_ssllService = new SSLLService(ConfigurationManager.AppSettings.Get("ApiUrl"));
21+
_analyze = _ssllService.Analyze(_host);
22+
}
23+
24+
[TestMethod]
25+
public void then_the_error_count_should_be_zero()
26+
{
27+
_analyze.Errors.Count.Should().Be(0);
28+
}
29+
30+
[TestMethod]
31+
public void then_HasErrorOccurred_should_be_false()
32+
{
33+
_analyze.HasErrorOccurred.Should().BeFalse();
34+
}
35+
36+
[TestMethod]
37+
public void then_status_code_header_should_be_greater_than_zero()
38+
{
39+
_analyze.Header.statusCode.Should().BeGreaterThan(0);
40+
}
41+
42+
[TestMethod]
43+
public void then_status_code_header_should_not_be_404()
44+
{
45+
_analyze.Header.statusCode.Should().NotBe(404);
46+
}
47+
48+
[TestMethod]
49+
public void then_should_not_trigger_an_api_invocation_error()
50+
{
51+
_analyze.Header.statusCode.Should().NotBe(400);
52+
}
53+
54+
[TestMethod]
55+
public void then_should_analyze_status_should_not_be_null()
56+
{
57+
_analyze.status.Should().NotBeNullOrEmpty();
58+
}
59+
60+
[TestMethod]
61+
public void then_start_time_should_be_greater_than_zero()
62+
{
63+
_analyze.startTime.Should().BeGreaterThan(0);
64+
}
65+
66+
[TestMethod]
67+
public void then_the_host_in_the_response_should_match_the_request()
68+
{
69+
_analyze.host.Should().Match(_host);
70+
}
71+
}
72+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<appSettings>
4+
<add key="ApiUrl" value="https://api.dev.ssllabs.com/api/fa78d5a4/"/>
5+
<add key="EndpointHost" value="https://www.ashleypoole.co.uk"/>
6+
<add key="EndpointIP" value="104.28.6.2"/>
7+
</appSettings>
8+
</configuration>
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
using System.Configuration;
2+
using FluentAssertions;
3+
using Microsoft.VisualStudio.TestTools.UnitTesting;
4+
using SSLLWrapper;
5+
using SSLLWrapper.Models.Response;
6+
7+
namespace given_that_I_make_a_GetEndpointDetails_request
8+
{
9+
// Before running GetEndpointDetails() Analyze must be called to first test the Endpoints.
10+
// Failure to do so will result in failed tests.
11+
12+
[TestClass]
13+
public class when_i_expect_a_successful_result
14+
{
15+
private static Endpoint _endpoint;
16+
private static string _endpointHost;
17+
private static string _endpointIp;
18+
19+
[ClassInitialize]
20+
public static void Setup(TestContext testContext)
21+
{
22+
_endpointHost = ConfigurationManager.AppSettings.Get("EndpointHost");
23+
_endpointIp = ConfigurationManager.AppSettings.Get("EndpointIP");
24+
25+
var ssllService = new SSLLService(ConfigurationManager.AppSettings.Get("ApiUrl"));
26+
_endpoint = ssllService.GetEndpointData(_endpointHost, _endpointIp);
27+
}
28+
29+
[TestMethod]
30+
public void then_the_error_count_should_be_zero()
31+
{
32+
_endpoint.Errors.Count.Should().Be(0);
33+
}
34+
35+
[TestMethod]
36+
public void then_HasErrorOccurred_should_be_false()
37+
{
38+
_endpoint.HasErrorOccurred.Should().BeFalse();
39+
}
40+
41+
[TestMethod]
42+
public void then_status_code_header_should_be_greater_than_zero()
43+
{
44+
_endpoint.Header.statusCode.Should().BeGreaterThan(0);
45+
}
46+
47+
[TestMethod]
48+
public void then_status_code_header_should_not_be_404()
49+
{
50+
_endpoint.Header.statusCode.Should().NotBe(404);
51+
}
52+
53+
[TestMethod]
54+
public void then_should_not_trigger_an_api_invocation_error()
55+
{
56+
_endpoint.Header.statusCode.Should().NotBe(400);
57+
}
58+
59+
[TestMethod]
60+
public void then_the_ip_in_the_response_should_match_the_request()
61+
{
62+
_endpoint.ipAddress.Should().Match(_endpointIp);
63+
}
64+
65+
[TestMethod]
66+
public void then_the_status_message_should_not_be_null()
67+
{
68+
_endpoint.statusMessage.Should().NotBeNullOrEmpty();
69+
}
70+
71+
[TestMethod]
72+
public void then_the_cert_subject_should_not_be_null()
73+
{
74+
_endpoint.Details.cert.subject.Should().NotBeNullOrEmpty();
75+
}
76+
}
77+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
using System.Configuration;
2+
using FluentAssertions;
3+
using Microsoft.VisualStudio.TestTools.UnitTesting;
4+
using SSLLWrapper;
5+
using SSLLWrapper.Models.Response;
6+
7+
namespace given_that_I_make_a_GetStatusCodes_request
8+
{
9+
[TestClass]
10+
public class when_i_expect_a_successful_result
11+
{
12+
private static StatusCodes _statusCodes;
13+
14+
[ClassInitialize]
15+
public static void Setup(TestContext testContext)
16+
{
17+
var ssllService = new SSLLService(ConfigurationManager.AppSettings.Get("ApiUrl"));
18+
_statusCodes = ssllService.GetStatusCodes();
19+
}
20+
21+
[TestMethod]
22+
public void then_the_error_count_should_be_zero()
23+
{
24+
_statusCodes.Errors.Count.Should().Be(0);
25+
}
26+
27+
[TestMethod]
28+
public void then_HasErrorOccurred_should_be_false()
29+
{
30+
_statusCodes.HasErrorOccurred.Should().BeFalse();
31+
}
32+
33+
[TestMethod]
34+
public void then_status_code_header_should_be_greater_than_zero()
35+
{
36+
_statusCodes.Header.statusCode.Should().BeGreaterThan(0);
37+
}
38+
39+
[TestMethod]
40+
public void then_status_code_header_should_be_not_be_404()
41+
{
42+
_statusCodes.Header.statusCode.Should().NotBe(404);
43+
}
44+
45+
[TestMethod]
46+
public void then_CHECKING_REVOCATION_should_not_be_null()
47+
{
48+
_statusCodes.StatusDetails.TESTING_SUITES.Should().NotBeNullOrEmpty();
49+
}
50+
51+
[TestMethod]
52+
public void then_should_not_trigger_an_api_invocation_error()
53+
{
54+
_statusCodes.Header.statusCode.Should().NotBe(400);
55+
}
56+
}
57+
}

0 commit comments

Comments
 (0)