Skip to content

Commit

Permalink
feat: message examiner (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
whichwit authored Jan 16, 2024
1 parent 41d32da commit 768543b
Show file tree
Hide file tree
Showing 21 changed files with 661 additions and 208 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,5 @@ FodyWeavers.xsd

# JetBrains Rider
*.sln.iml

.DS_Store
6 changes: 3 additions & 3 deletions projects/Canary.Tests/Canary.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.4" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
<PackageReference Include="coverlet.collector" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
Expand Down
10 changes: 10 additions & 0 deletions projects/Canary.Tests/MessagesControllerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Microsoft.AspNetCore.Http;
using System.Collections.Generic;
using VRDR;
using canary.Models;

namespace canary.tests
{
Expand Down Expand Up @@ -43,12 +44,21 @@ public async void BadNewMessagePostReturnsIssues()
};
_messagesController.ControllerContext.HttpContext = httpContext;
var response = await _messagesController.NewMessagePost();
var message = response.message;
var issues = response.issues[0];
Assert.Equal(2, issues.Count);
Assert.Contains(new KeyValuePair<string, string>("severity", "error"), issues);
Assert.Contains(new KeyValuePair<string, string>("message", "Failed to find a Bundle Entry containing a Resource of type MessageHeader. Error occurred at VRDR.BaseMessage in function Parse."), issues);
}

[Fact]
public void TestUnknownDescriptionMessageProperties()
{
string desc = Message.GetDescriptionFor("AUTOP");

Assert.Equal("Was Autopsy performed", desc, true, true, true, true);
}

private string FixturePath(string filePath)
{
if (Path.IsPathRooted(filePath))
Expand Down
2 changes: 2 additions & 0 deletions projects/Canary.Tests/RecordTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public void TestNonDocumentTypePayload()
Assert.Contains("error", issueList.ToString());

}

[Fact]
public void TestMissingTypePayload()
{
Expand All @@ -68,6 +69,7 @@ public void TestMissingTypePayload()

Assert.Contains("error", issueList.ToString());
}

private string FixturePath(string filePath)
{
if (Path.IsPathRooted(filePath))
Expand Down
8 changes: 4 additions & 4 deletions projects/Canary/Canary.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.5" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="6.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.13" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.25" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="6.0.25" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.14" />
<PackageReference Include="Bogus" Version="35.3.0" />

<ProjectReference Include="..\VitalRecord\VitalRecord.csproj" />
Expand Down
Loading

0 comments on commit 768543b

Please sign in to comment.