Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: message examiner #6

Merged
merged 5 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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