Skip to content

Commit

Permalink
[add] .NET Framework 4.8 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
i4004 committed May 19, 2024
1 parent 0660d4b commit 4972ed1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ public class ExecutionWorkOrderBuilderTests
public void Build()
{
// Arrange
var builder = new ExecutionWorkOrderBuilder();

builder.HttpStatusCode = HttpStatusCode.EarlyHints;
var builder = new ExecutionWorkOrderBuilder
{
HttpStatusCode = HttpStatusCode.BadRequest
};

builder.Controllers.Add(CreateController(3));
builder.Controllers.Add(CreateController(1));
Expand All @@ -29,7 +31,7 @@ public void Build()

// Assert

Assert.That(result.HttpStatusCode, Is.EqualTo(HttpStatusCode.EarlyHints));
Assert.That(result.HttpStatusCode, Is.EqualTo(HttpStatusCode.BadRequest));

Assert.That(result.Controllers.Count, Is.EqualTo(5));
Assert.That(result.Controllers[0].Controller.ExecParameters!.RunPriority, Is.EqualTo(1));
Expand Down
9 changes: 8 additions & 1 deletion src/Simplify.Web.Tests/Simplify.Web.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net8.0;net48</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<WarningsAsErrors>nullable</WarningsAsErrors>

Expand All @@ -20,6 +21,9 @@
<PackageReference Include="Simplify.System" Version="1.6.2" />
<PackageReference Include="Simplify.Xml" Version="1.3.*" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net48' ">
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.0" />
</ItemGroup>
<ItemGroup>
<None Remove="Templates\Test.tpl" />
</ItemGroup>
Expand All @@ -34,4 +38,7 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Controllers\V2\Matcher\" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ public async Task Execute_CachedFile_RespectiveResponsePropertiesAreSet()

Assert.That(response.StatusCode, Is.EqualTo((int)HttpStatusCode.NotModified));
Assert.That(response.ContentType, Is.EqualTo("text/plain"));
Assert.That(response.Headers.LastModified, Is.EqualTo(lastModificationTime.ToString("r")));
Assert.That(response.Headers["Last-Modified"], Is.EqualTo(lastModificationTime.ToString("r")));
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Moq;
Expand Down Expand Up @@ -82,8 +81,8 @@ public async Task Execute_NewFile_FileSendToClientAndRespectiveResponsePropertie
// Assert

Assert.That(response.ContentType, Is.EqualTo("text/plain"));
Assert.That(response.Headers.LastModified, Is.EqualTo(lastModificationTime.ToString("r")));
Assert.That(response.Headers.Expires.First(), Is.EqualTo(new DateTimeOffset(new DateTime(2014, 1, 1)).ToString("R")));
Assert.That(response.Headers["Last-Modified"], Is.EqualTo(lastModificationTime.ToString("r")));
Assert.That(response.Headers["Expires"], Is.EqualTo(new DateTimeOffset(new DateTime(2014, 1, 1)).ToString("R")));

_responseWriter.Verify(x => x.WriteAsync(It.Is<HttpResponse>(r => r == response), It.Is<byte[]>(b => b == data)));
}
Expand Down

0 comments on commit 4972ed1

Please sign in to comment.