Skip to content

Commit 06f8b6d

Browse files
committed
Adding more unit tests
1 parent 7bde817 commit 06f8b6d

File tree

5 files changed

+364
-4
lines changed

5 files changed

+364
-4
lines changed

SSLLWrapper.Tests/AnalyzeTests.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using FluentAssertions;
1+
using System.Linq;
2+
using System.Security.Cryptography.X509Certificates;
3+
using FluentAssertions;
24
using Microsoft.VisualStudio.TestTools.UnitTesting;
35
using Moq;
46
using SSLLWrapper;
@@ -164,6 +166,26 @@ public static void Setup(TestContext testContext)
164166
}
165167
}
166168

169+
[TestClass]
170+
public class when_a_invalid_request_is_made_with_malformed_url_hostname : NegativeTests
171+
{
172+
[ClassInitialize]
173+
public static void Setup(TestContext testContext)
174+
{
175+
var mockedApiProvider = new Mock<IApiProvider>();
176+
TestHost = "www.ashleypoole.somereallybadurl";
177+
178+
var ssllService = new SSLLService("https://api.dev.ssllabs.com/api/fa78d5a4/", mockedApiProvider.Object);
179+
Response = ssllService.Analyze(TestHost);
180+
}
181+
182+
[TestMethod]
183+
public void then_preflight_error_should_be_thrown()
184+
{
185+
Response.Errors.Any(x => x.message == "Host does not pass preflight validation. No Api call has been made.").Should().BeTrue();
186+
}
187+
}
188+
167189
public abstract class PositiveTests : GenericPositiveTests<Analyze>
168190
{
169191
public static string TestHost;

0 commit comments

Comments
 (0)