-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Improve code coverage * Pin culture of the size formatter
- Loading branch information
1 parent
3e4a264
commit f336b9c
Showing
5 changed files
with
93 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System.Net; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
|
||
using GenHTTP.Modules.IO; | ||
|
||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace GenHTTP.Testing.Acceptance.Engine | ||
{ | ||
|
||
[TestClass] | ||
public sealed class MethodTests | ||
{ | ||
|
||
[TestMethod] | ||
public async Task TestCustomMethods() | ||
{ | ||
var result = Content.From(Resource.FromString("OK")); | ||
|
||
using var host = TestHost.Run(result); | ||
|
||
var request = host.GetRequest(method: new HttpMethod("BREW")); | ||
|
||
using var response = await host.GetResponseAsync(request); | ||
|
||
await response.AssertStatusAsync(HttpStatusCode.OK); | ||
} | ||
|
||
} | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
Testing/Acceptance/Engine/SimpleCertificateProviderTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System.Security.Cryptography.X509Certificates; | ||
|
||
using GenHTTP.Engine.Infrastructure.Endpoints; | ||
|
||
using NSubstitute; | ||
|
||
namespace GenHTTP.Testing.Acceptance.Engine | ||
{ | ||
|
||
[TestClass] | ||
public sealed class SimpleCertificateProviderTest | ||
{ | ||
|
||
[TestMethod] | ||
public void TestProvider() | ||
{ | ||
using var cert = Substitute.For<X509Certificate2>(); | ||
|
||
var provider = new SimpleCertificateProvider(cert); | ||
|
||
Assert.IsNotNull(provider.Provide("google.com")); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
Testing/Acceptance/Modules/DirectoryBrowsing/FormatterTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using GenHTTP.Modules.DirectoryBrowsing.Provider; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace GenHTTP.Testing.Acceptance.Modules.DirectoryBrowsing | ||
{ | ||
|
||
[TestClass] | ||
public sealed class FormatterTest | ||
{ | ||
|
||
[TestMethod] | ||
public void TestFormatting() | ||
{ | ||
Assert.AreEqual("512 Bytes", FileSizeFormatter.Format(512)); | ||
|
||
Assert.AreEqual("2.78 KB", FileSizeFormatter.Format(2842)); | ||
|
||
Assert.AreEqual("2.78 MB", FileSizeFormatter.Format(2842 * 1024)); | ||
|
||
Assert.AreEqual("2.78 GB", FileSizeFormatter.Format(2842L * 1024 * 1024)); | ||
|
||
Assert.AreEqual("2.78 TB", FileSizeFormatter.Format(2842L * 1024 * 1024 * 1024)); | ||
} | ||
|
||
} | ||
|
||
} |