Skip to content

Commit

Permalink
Add more integration tests and remove inaccurate benchmarks (#29)
Browse files Browse the repository at this point in the history
* more integration tests

* Remove benchmarks as they were inaccurate
  • Loading branch information
JonathanBout authored Dec 7, 2024
1 parent 8acf52d commit 629dc70
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 81 deletions.
37 changes: 0 additions & 37 deletions SimpleCDN.Benchmarks/Benchmarks.cs

This file was deleted.

8 changes: 0 additions & 8 deletions SimpleCDN.Benchmarks/GlobalSuppressions.cs

This file was deleted.

4 changes: 0 additions & 4 deletions SimpleCDN.Benchmarks/Program.cs

This file was deleted.

7 changes: 0 additions & 7 deletions SimpleCDN.Benchmarks/Properties/launchSettings.json

This file was deleted.

18 changes: 0 additions & 18 deletions SimpleCDN.Benchmarks/SimpleCDN.Benchmarks.csproj

This file was deleted.

25 changes: 24 additions & 1 deletion SimpleCDN.Tests.Integration/EndpointTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
namespace SimpleCDN.Tests.Integration
using System.Net;
using System.Net.Http.Headers;

namespace SimpleCDN.Tests.Integration
{
public class EndpointTests : IClassFixture<CustomWebApplicationFactory>
{
Expand Down Expand Up @@ -58,5 +61,25 @@ public async Task Test_FileExists_WithContent(string endpoint, string expectedTe
var content = await response.Content.ReadAsStringAsync();
Assert.Contains(expectedText, content);
}

[Theory]
[InlineData("/test.txt", "text/plain", false)]
[InlineData("/test.txt", "application/json",true)]
[InlineData("/data/test.json", "application/json", false)]
[InlineData("/data/test.json", "text/plain", true)]
public async Task Test_UnsupportedMediaType_WhenWrongAcceptHeader(string endpoint, string supportedMediaType, bool shouldFail)
{
var client = _webApplicationFactory.CreateClient();
var request = new HttpRequestMessage(HttpMethod.Get, endpoint);
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(supportedMediaType));
var response = await client.SendAsync(request);
if (shouldFail)
{
Assert.Equal(HttpStatusCode.NotAcceptable, response.StatusCode);
} else
{
Assert.True(response.IsSuccessStatusCode, response.StatusCode.ToString());
}
}
}
}
6 changes: 0 additions & 6 deletions SimpleCDN.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-co
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleCDN.Tests", "SimpleCDN.Tests\SimpleCDN.Tests.csproj", "{9F41AC4B-73A5-AED7-2FAD-13532040B2E1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleCDN.Benchmarks", "SimpleCDN.Benchmarks\SimpleCDN.Benchmarks.csproj", "{01B35836-CD1D-0631-A280-04996E3E2058}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleCDN.Tests.Integration", "SimpleCDN.Tests.Integration\SimpleCDN.Tests.Integration.csproj", "{748DF05A-61E9-3214-6751-2FB8D9C75A1C}"
EndProject
Global
Expand All @@ -30,10 +28,6 @@ Global
{9F41AC4B-73A5-AED7-2FAD-13532040B2E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9F41AC4B-73A5-AED7-2FAD-13532040B2E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9F41AC4B-73A5-AED7-2FAD-13532040B2E1}.Release|Any CPU.Build.0 = Release|Any CPU
{01B35836-CD1D-0631-A280-04996E3E2058}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{01B35836-CD1D-0631-A280-04996E3E2058}.Debug|Any CPU.Build.0 = Debug|Any CPU
{01B35836-CD1D-0631-A280-04996E3E2058}.Release|Any CPU.ActiveCfg = Release|Any CPU
{01B35836-CD1D-0631-A280-04996E3E2058}.Release|Any CPU.Build.0 = Release|Any CPU
{748DF05A-61E9-3214-6751-2FB8D9C75A1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{748DF05A-61E9-3214-6751-2FB8D9C75A1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{748DF05A-61E9-3214-6751-2FB8D9C75A1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down

0 comments on commit 629dc70

Please sign in to comment.