diff --git a/.github/workflows/dotnet-format.yml b/.github/workflows/dotnet-format.yml
new file mode 100644
index 0000000..4958aa6
--- /dev/null
+++ b/.github/workflows/dotnet-format.yml
@@ -0,0 +1,21 @@
+name: Format check
+on:
+ push:
+ branches: [ "main" ]
+ pull_request:
+ branches: [ "main" ]
+jobs:
+ dotnet-format:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: 8.0.x
+
+ - name: Format
+ working-directory: ./src
+ run: dotnet format --verify-no-changes
+
\ No newline at end of file
diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index c07b9ab..35a6c10 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -1,7 +1,7 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
-name: .NET
+name: Build & Test check
on:
push:
diff --git a/src/Raygun.NetCore.Blazor.WebAssembly/Controls/RaygunErrorBoundary.cs b/src/Raygun.NetCore.Blazor.WebAssembly/Controls/RaygunErrorBoundary.cs
index 7785911..df83ce8 100644
--- a/src/Raygun.NetCore.Blazor.WebAssembly/Controls/RaygunErrorBoundary.cs
+++ b/src/Raygun.NetCore.Blazor.WebAssembly/Controls/RaygunErrorBoundary.cs
@@ -75,7 +75,7 @@ protected override void BuildRenderTree(RenderTreeBuilder builder)
{
if (ErrorContent is not null)
{
- builder.AddContent(1, ErrorContent(CurrentException));
+ builder.AddContent(1, ErrorContent(CurrentException));
}
else
{
diff --git a/src/Raygun.NetCore.Blazor/Models/BreadcrumbDetails.cs b/src/Raygun.NetCore.Blazor/Models/BreadcrumbDetails.cs
index b5f7944..88cf506 100644
--- a/src/Raygun.NetCore.Blazor/Models/BreadcrumbDetails.cs
+++ b/src/Raygun.NetCore.Blazor/Models/BreadcrumbDetails.cs
@@ -22,7 +22,7 @@ internal record BreadcrumbDetails
///
/// A custom value used to arbitrarily group this Breadcrumb.
///
- [JsonInclude]
+ [JsonInclude]
public string Category { get; set; }
///
@@ -34,7 +34,7 @@ internal record BreadcrumbDetails
///
/// Any custom data you want to record about application state when the Breadcrumb was recorded.
///
- [JsonInclude]
+ [JsonInclude]
public Dictionary CustomData { get; set; }
///
@@ -46,7 +46,7 @@ internal record BreadcrumbDetails
///
/// The message you want to record for this Breadcrumb.
///
- [JsonInclude]
+ [JsonInclude]
public string Message { get; set; }
///
@@ -70,7 +70,7 @@ internal record BreadcrumbDetails
///
/// The for the message. Defaults to .
///
- [JsonInclude]
+ [JsonInclude]
public BreadcrumbType Type { get; set; }
#endregion
diff --git a/src/Raygun.NetCore.Blazor/Models/BrowserSpecs.cs b/src/Raygun.NetCore.Blazor/Models/BrowserSpecs.cs
index f3dc4b3..3f3986c 100644
--- a/src/Raygun.NetCore.Blazor/Models/BrowserSpecs.cs
+++ b/src/Raygun.NetCore.Blazor/Models/BrowserSpecs.cs
@@ -3,7 +3,6 @@
namespace Raygun.NetCore.Blazor.Models
{
-
///
/// Attributes about the Browser that are highly unlikely to change at runtime.
///
@@ -13,7 +12,6 @@ namespace Raygun.NetCore.Blazor.Models
///
internal record BrowserSpecs
{
-
#region Private Members
private string calculatedBrowserVersion;
@@ -142,7 +140,5 @@ internal void ParseUserAgent()
}
#endregion
-
}
-
-}
+}
\ No newline at end of file
diff --git a/src/Raygun.NetCore.Blazor/Models/BrowserUserAgentData.cs b/src/Raygun.NetCore.Blazor/Models/BrowserUserAgentData.cs
index 61e1456..b504f51 100644
--- a/src/Raygun.NetCore.Blazor/Models/BrowserUserAgentData.cs
+++ b/src/Raygun.NetCore.Blazor/Models/BrowserUserAgentData.cs
@@ -38,7 +38,7 @@ internal record BrowserUserAgentData
///
///
public string CalculatedOSVersion => $"{Platform} {(
- Platform == "Windows" && Decimal.Parse(PlatformVersion?.Split(".")?[0] ?? "0") >= 13 ? "11" :
+ Platform == "Windows" && Decimal.Parse(PlatformVersion?.Split(".")?[0] ?? "0") >= 13 ? "11" :
Platform == "Windows" && Decimal.Parse(PlatformVersion?.Split(".")?[0] ?? "0") < 13 ? "10" :
PlatformVersion)}";
diff --git a/src/Raygun.NetCore.Blazor/Models/ClientDetails.cs b/src/Raygun.NetCore.Blazor/Models/ClientDetails.cs
index d26f700..e3e080a 100644
--- a/src/Raygun.NetCore.Blazor/Models/ClientDetails.cs
+++ b/src/Raygun.NetCore.Blazor/Models/ClientDetails.cs
@@ -15,19 +15,19 @@ internal record ClientDetails
///
/// The name of this Client library.
///
- [JsonInclude]
+ [JsonInclude]
public string Name { get; set; }
///
/// The version of this Client library.
///
- [JsonInclude]
+ [JsonInclude]
public string Version { get; set; }
///
/// The URL for the repository this Client library is maintained in.
///
- [JsonInclude]
+ [JsonInclude]
public string ClientUrl { get; set; }
#endregion
diff --git a/src/Raygun.NetCore.Blazor/Models/EnvironmentDetails.cs b/src/Raygun.NetCore.Blazor/Models/EnvironmentDetails.cs
index 68dcf22..61b435a 100644
--- a/src/Raygun.NetCore.Blazor/Models/EnvironmentDetails.cs
+++ b/src/Raygun.NetCore.Blazor/Models/EnvironmentDetails.cs
@@ -187,11 +187,11 @@ internal EnvironmentDetails(BrowserSpecs specs, BrowserStats stats)
ColorDepth = specs.ColorDepth;
CurrentOrientation = stats.Orientation.ToString();
DeviceManufacturer = !string.IsNullOrWhiteSpace(specs.DeviceManufacturer) ? specs.DeviceManufacturer : null;
- DeviceModel = !string.IsNullOrWhiteSpace(specs.DeviceModel) ? specs.DeviceModel: null;
+ DeviceModel = !string.IsNullOrWhiteSpace(specs.DeviceModel) ? specs.DeviceModel : null;
DeviceName = !string.IsNullOrWhiteSpace(specs.DeviceName) ? specs.DeviceName : null; ;
Locale = specs.Locale;
OSVersion = !string.IsNullOrWhiteSpace(specs.UAHints?.CalculatedOSVersion) ? specs.UAHints.CalculatedOSVersion : specs.CalculatedOSVersion;
- Platform = specs.UAHints.CalculatedPlatform ?? specs.Platform;
+ Platform = specs.UAHints?.CalculatedPlatform ?? specs.Platform;
ProcessorCount = specs.ProcessorCount;
ResolutionScale = stats.DevicePixelRatio;
ScreenHeight = specs.ScreenHeight;
diff --git a/src/Raygun.NetCore.Blazor/Models/ErrorDetails.cs b/src/Raygun.NetCore.Blazor/Models/ErrorDetails.cs
index 57d7d00..5204854 100644
--- a/src/Raygun.NetCore.Blazor/Models/ErrorDetails.cs
+++ b/src/Raygun.NetCore.Blazor/Models/ErrorDetails.cs
@@ -19,37 +19,37 @@ internal class ErrorDetails
///
/// The name of the the error was produced in.
///
- [JsonInclude]
+ [JsonInclude]
public string ClassName { get; set; }
///
/// Data contained in the error object.
///
- [JsonInclude]
+ [JsonInclude]
public NonGeneric.IDictionary Data { get; set; }
///
/// Details about the symbol files related to the error.
///
- [JsonInclude]
+ [JsonInclude]
public List Images { get; set; }
///
///
///
- [JsonInclude]
+ [JsonInclude]
public ErrorDetails InnerError { get; set; }
///
///
///
- [JsonInclude]
+ [JsonInclude]
public List InnerErrors { get; set; }
///
///
///
- [JsonInclude]
+ [JsonInclude]
public string Message { get; set; }
///
@@ -58,7 +58,7 @@ internal class ErrorDetails
///
/// The first one in the list should be the highest on the stack
///
- [JsonInclude]
+ [JsonInclude]
public List StackTrace { get; set; }
#endregion
diff --git a/src/Raygun.NetCore.Blazor/Models/EventDetails.cs b/src/Raygun.NetCore.Blazor/Models/EventDetails.cs
index c002cd2..526aded 100644
--- a/src/Raygun.NetCore.Blazor/Models/EventDetails.cs
+++ b/src/Raygun.NetCore.Blazor/Models/EventDetails.cs
@@ -22,19 +22,19 @@ internal record EventDetails
///
/// A trail of breadcrumbs leading up to this event.
///
- [JsonInclude]
+ [JsonInclude]
public List Breadcrumbs { get; set; }
///
/// Information about the client library you are using for talking to the Raygun API.
///
- [JsonInclude]
+ [JsonInclude]
public ClientDetails Client { get; set; }
///
/// Information about the environment at the time of the event.
///
- [JsonInclude]
+ [JsonInclude]
public EnvironmentDetails Environment { get; set; }
///
@@ -49,19 +49,19 @@ internal record EventDetails
///
/// Must be 1-100 chars, ideally the result of a hash function e.g MD5
///
- [JsonInclude]
+ [JsonInclude]
public string GroupingKey { get; set; }
///
/// The name of machine this event occurred on
///
- [JsonInclude]
+ [JsonInclude]
public string MachineName { get; set; }
///
/// Information about the HTTP request being processed when the error occurred.
///
- [JsonInclude]
+ [JsonInclude]
public RequestDetails Request { get; set; }
///
@@ -70,7 +70,7 @@ internal record EventDetails
///
/// These will be searchable and filterable on the dashboard.
///
- [JsonInclude]
+ [JsonInclude]
public List Tags { get; set; }
///
@@ -85,7 +85,7 @@ internal record EventDetails
///
/// These will be searchable on the dashboard.
///
- [JsonInclude]
+ [JsonInclude]
public Dictionary UserCustomData { get; set; }
#endregion
diff --git a/src/Raygun.NetCore.Blazor/Models/RaygunRequest.cs b/src/Raygun.NetCore.Blazor/Models/RaygunRequest.cs
index fcef24a..682ea92 100644
--- a/src/Raygun.NetCore.Blazor/Models/RaygunRequest.cs
+++ b/src/Raygun.NetCore.Blazor/Models/RaygunRequest.cs
@@ -31,7 +31,7 @@ internal record RaygunRequest
public RequestQueueStatus QueueStatus { get; set; }
#endregion
-
+
#region Constructors
///
diff --git a/src/Raygun.NetCore.Blazor/Models/RequestDetails.cs b/src/Raygun.NetCore.Blazor/Models/RequestDetails.cs
index 54143da..05a318d 100644
--- a/src/Raygun.NetCore.Blazor/Models/RequestDetails.cs
+++ b/src/Raygun.NetCore.Blazor/Models/RequestDetails.cs
@@ -36,7 +36,7 @@ internal record RequestDetails
/// The HTTP method used to request the URL (GET, POST, PUT, etc).
///
[JsonInclude]
- public HttpMethod HttpMethod { get; set; }
+ public string HttpMethod { get; set; }
///
/// The IP address of the client that initiated the request.
diff --git a/src/Raygun.NetCore.Blazor/Models/StackTraceDetails.cs b/src/Raygun.NetCore.Blazor/Models/StackTraceDetails.cs
index f769e5d..c887bf7 100644
--- a/src/Raygun.NetCore.Blazor/Models/StackTraceDetails.cs
+++ b/src/Raygun.NetCore.Blazor/Models/StackTraceDetails.cs
@@ -15,19 +15,19 @@ internal class StackTraceDetails
///
/// The name of the class this stack frame is in.
///
- [JsonInclude]
+ [JsonInclude]
public string ClassName { get; set; }
///
/// The column of the file that this stack frame is in.
///
- [JsonInclude]
+ [JsonInclude]
public int ColumnNumber { get; set; }
///
/// The name of the file this stack frame is in.
///
- [JsonInclude]
+ [JsonInclude]
public string FileName { get; set; }
///
diff --git a/src/Raygun.NetCore.Blazor/RaygunBlazorClient.cs b/src/Raygun.NetCore.Blazor/RaygunBlazorClient.cs
index 98467bf..a321618 100644
--- a/src/Raygun.NetCore.Blazor/RaygunBlazorClient.cs
+++ b/src/Raygun.NetCore.Blazor/RaygunBlazorClient.cs
@@ -129,9 +129,9 @@ public async Task InitializeAsync()
///
/// TBD
///
- public void RecordBreadcrumb(string message, BreadcrumbType breadcrumbType = BreadcrumbType.Manual, string category = null,
+ public void RecordBreadcrumb(string message, BreadcrumbType breadcrumbType = BreadcrumbType.Manual, string category = null,
Dictionary customData = null, string platform = "DotNet")
- {
+ {
_breadcrumbs.Add(new BreadcrumbDetails(message, breadcrumbType, category, customData, platform));
}
diff --git a/src/Raygun.NetCore.Blazor/RaygunBrowserInterop.cs b/src/Raygun.NetCore.Blazor/RaygunBrowserInterop.cs
index e8a205d..629b7fc 100644
--- a/src/Raygun.NetCore.Blazor/RaygunBrowserInterop.cs
+++ b/src/Raygun.NetCore.Blazor/RaygunBrowserInterop.cs
@@ -98,7 +98,7 @@ public RaygunBrowserInterop(IJSRuntime jsRuntime, IWindowService windowService,
///
///
[JSInvokable]
- public async ValueTask RecordJsBreadcrumb(string message, BreadcrumbType breadcrumbType = BreadcrumbType.Manual,
+ public async ValueTask RecordJsBreadcrumb(string message, BreadcrumbType breadcrumbType = BreadcrumbType.Manual,
string category = null, Dictionary customData = null)
{
_breadcrumbAction.Invoke(message, breadcrumbType, category, customData, "JavaScript");
@@ -154,7 +154,7 @@ internal async Task InitializeAsync(Func onUnhandledJsExceptio
// RWM: We're going to register the Raygun script and get the BrowserSpecs first. The reason why is because if we
// handle JS errors & they start coming in before we're ready, then there will be wailing and gnashing of teeth.
RaygunScriptReference = await _jsRuntime.InvokeAsync("import", "./_content/Raygun.NetCore.Blazor/Raygun.NetCore.Blazor.js");
-
+
// RWM: Register the .NET reference with JS so that JS code can also manually create Bookmarks and report Exceptions.
await _jsRuntime.InvokeVoidAsync("window.raygunBlazor.initialize", _dotNetReference);
diff --git a/src/Raygun.NetCore.Tests.Blazor.WebAssembly/RaygunExceptionCatcherTests.cs b/src/Raygun.NetCore.Tests.Blazor.WebAssembly/RaygunExceptionCatcherTests.cs
index 3a93553..e8400d9 100644
--- a/src/Raygun.NetCore.Tests.Blazor.WebAssembly/RaygunExceptionCatcherTests.cs
+++ b/src/Raygun.NetCore.Tests.Blazor.WebAssembly/RaygunExceptionCatcherTests.cs
@@ -1,17 +1,16 @@
-using CloudNimble.Breakdance.Blazor;
+using Bunit;
+using CloudNimble.Breakdance.Blazor;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Raygun4Net.Tests.Blazor.WebAssembly
+namespace Raygun.NetCore.Tests.Blazor.WebAssembly
{
-
///
///
///
[TestClass]
public class RaygunExceptionCatcherTests : BlazorBreakdanceTestBase
{
-
#region Test Lifecycle
[TestInitialize]
@@ -21,16 +20,12 @@ public void Setup()
{
services.AddRaygunBlazor(context.Configuration);
});
- TestSetup();
+ TestSetup(JSRuntimeMode.Loose);
}
[TestCleanup]
public void TearDown() => TestTearDown();
#endregion
-
-
-
}
-
-}
+}
\ No newline at end of file
diff --git a/src/Raygun.NetCore.Tests.Blazor.WebAssembly/appsettings.json b/src/Raygun.NetCore.Tests.Blazor.WebAssembly/appsettings.json
index 7f9e600..598ca55 100644
--- a/src/Raygun.NetCore.Tests.Blazor.WebAssembly/appsettings.json
+++ b/src/Raygun.NetCore.Tests.Blazor.WebAssembly/appsettings.json
@@ -1,4 +1,5 @@
{
"Raygun": {
+ "ApiKey": "APIKEY"
}
}
diff --git a/src/Raygun.NetCore.Tests.Blazor/BreadcrumbDetailsTests.cs b/src/Raygun.NetCore.Tests.Blazor/BreadcrumbDetailsTests.cs
index edf37d7..307b73b 100644
--- a/src/Raygun.NetCore.Tests.Blazor/BreadcrumbDetailsTests.cs
+++ b/src/Raygun.NetCore.Tests.Blazor/BreadcrumbDetailsTests.cs
@@ -40,7 +40,7 @@ public void Breadcrumbs_NewInstance_MessageOverload()
bc.Timestamp.Should().BePositive();
bc.Message.Should().Be("Test");
bc.MethodName.Should().Be(nameof(Breadcrumbs_NewInstance_MessageOverload));
- bc.LineNumber.Should().Be(25);
+ bc.LineNumber.Should().Be(38);
}
#endregion
diff --git a/src/Raygun.NetCore.Tests.Blazor/Extensions/IServiceCollectionExtensionsTests.cs b/src/Raygun.NetCore.Tests.Blazor/Extensions/IServiceCollectionExtensionsTests.cs
index fdb07eb..ff14547 100644
--- a/src/Raygun.NetCore.Tests.Blazor/Extensions/IServiceCollectionExtensionsTests.cs
+++ b/src/Raygun.NetCore.Tests.Blazor/Extensions/IServiceCollectionExtensionsTests.cs
@@ -1,31 +1,30 @@
-using CloudNimble.Breakdance.Assemblies;
-using FluentAssertions;
+using FluentAssertions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Raygun.NetCore.Blazor;
using System.Net.Http;
+using Bunit;
+using CloudNimble.Breakdance.Blazor;
namespace Raygun.NetCore.Tests.Blazor.Extensions
{
-
///
///
///
[TestClass]
- public class IServiceCollectionExtensionsTests : BreakdanceTestBase
+ public class ServiceCollectionExtensionsTests : BlazorBreakdanceTestBase
{
-
#region Test Lifecycle
[TestInitialize]
public void Setup()
{
TestHostBuilder.ConfigureServices((context, services) =>
- {
+ {
services.AddRaygunBlazor(context.Configuration);
- });
- TestSetup();
+ });
+ TestSetup(JSRuntimeMode.Loose);
}
[TestCleanup]
@@ -52,8 +51,5 @@ public void AddRaygunBlazor_ShouldRegisterDependencies()
// TODO: RWM: What happens if the ApiKey is null or whitespace?
#endregion
-
-
}
-
-}
+}
\ No newline at end of file
diff --git a/src/Raygun.NetCore.Tests.Blazor/RaygunBlazorClientTests.cs b/src/Raygun.NetCore.Tests.Blazor/RaygunBlazorClientTests.cs
index 8493cce..eb42209 100644
--- a/src/Raygun.NetCore.Tests.Blazor/RaygunBlazorClientTests.cs
+++ b/src/Raygun.NetCore.Tests.Blazor/RaygunBlazorClientTests.cs
@@ -1,22 +1,21 @@
-using CloudNimble.Breakdance.Assemblies;
-using FluentAssertions;
+using FluentAssertions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Raygun.NetCore.Blazor;
using Raygun.NetCore.Blazor.Models;
using System;
using System.Threading.Tasks;
+using Bunit;
+using CloudNimble.Breakdance.Blazor;
namespace Raygun.NetCore.Tests.Blazor
{
-
///
/// Tests the functionality of the code that registers Raygun resources with the DI container.
///
[TestClass]
- public class IServiceCollectionExtensionsTests : BreakdanceTestBase
+ public class ServiceCollectionExtensionsTests : BlazorBreakdanceTestBase
{
-
#region Test Lifecycle
[TestInitialize]
@@ -24,9 +23,21 @@ public void Setup()
{
TestHostBuilder.ConfigureServices((context, services) =>
{
+ // Prepare fakes for BrowserSpecs and BrowserStats
+ var browserSpecs = new BrowserSpecs();
+ var browserStats = new BrowserStats();
+ browserSpecs.UserAgent =
+ "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0";
+
+ // BlazorBreakdanceTestBase exposes bunit JSInterop
+ BUnitTestContext.JSInterop.Setup("getBrowserSpecs").SetResult(browserSpecs);
+ BUnitTestContext.JSInterop.Setup("getBrowserStats").SetResult(browserStats);
+
services.AddRaygunBlazor(context.Configuration);
});
- TestSetup();
+
+ // See: https://bunit.dev/docs/test-doubles/emulating-ijsruntime.html
+ TestSetup(JSRuntimeMode.Loose);
}
[TestCleanup]
@@ -65,7 +76,5 @@ public async Task RaygunBlazorClient_BasicException_WithBreadcrumbs_ShouldSend()
}
#endregion
-
}
-
-}
+}
\ No newline at end of file
diff --git a/src/Raygun.NetCore.Tests.Blazor/SerializationTests.cs b/src/Raygun.NetCore.Tests.Blazor/SerializationTests.cs
index 6ca0645..d2f488a 100644
--- a/src/Raygun.NetCore.Tests.Blazor/SerializationTests.cs
+++ b/src/Raygun.NetCore.Tests.Blazor/SerializationTests.cs
@@ -1,10 +1,10 @@
-using FluentAssertions;
+using System;
+using System.Text.Json;
+using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Raygun.NetCore.Blazor.Models;
-using System;
-using System.Text.Json;
-namespace Raygun4Net.Tests.Blazor
+namespace Raygun.NetCore.Tests.Blazor
{
///
@@ -16,8 +16,8 @@ public class SerializationTests
#region Private Members
- private const string apiDocsPayload = "{\r\n \"occurredOn\": \"2015-09-08T01:55:28Z\",\r\n \"details\": {\r\n \"machineName\": \"ServerMachine1\",\r\n \"groupingKey\": \"ErrorGroup\",\r\n \"version\": \"1.0.0.1\",\r\n \"client\": {\r\n \"name\": \"Example Raygun Client\",\r\n \"version\": \"0.0.0.1\",\r\n \"clientUrl\": \"/documentation/integrations/api\"\r\n },\r\n \"error\": {\r\n \"innerError\": {},\r\n \"data\": {\r\n \"example\": 5\r\n },\r\n \"className\": \"ErrorClass\",\r\n \"message\": \"An error occurred\",\r\n \"stackTrace\": [\r\n {\r\n \"lineNumber\": 55,\r\n \"className\": \"BrokenService\",\r\n \"columnNumber\": 23,\r\n \"fileName\": \"BrokenService.cs\",\r\n \"methodName\": \"BreakEverything()\"\r\n }\r\n ]\r\n },\r\n \"environment\": {\r\n \"processorCount\": 4,\r\n \"osVersion\": \"Windows 10\",\r\n \"windowBoundsWidth\": 2560,\r\n \"windowBoundsHeight\": 1440,\r\n \"browser-Width\": 2560,\r\n \"browser-Height\": 1440,\r\n \"screen-Width\": 2560,\r\n \"screen-Height\": 1440,\r\n \"resolutionScale\": 1,\r\n \"color-Depth\": 24,\r\n \"currentOrientation\": \"Landscape\",\r\n \"cpu\": \"Intel(R) Core(TM) i5-2500 CPU @ 3.30GHz\",\r\n \"packageVersion\": \"package version\",\r\n \"architecture\": \"ARMv7-A\",\r\n \"deviceManufacturer\": \"Nokia\",\r\n \"model\": \"Lumia 920\",\r\n \"totalPhysicalMemory\": 1024,\r\n \"availablePhysicalMemory\": 500,\r\n \"totalVirtualMemory\": 500,\r\n \"availableVirtualMemory\": 500,\r\n \"diskSpaceFree\": [\r\n 50000.52,\r\n 2000.104\r\n ],\r\n \"deviceName\": \"Nexus 7\",\r\n \"locale\": \"en-nz\",\r\n \"utcOffset\": -12,\r\n \"browser\": \"Mozilla\",\r\n \"browserName\": \"Netscape\",\r\n \"browser-Version\": \"5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.65 Safari/537.36\",\r\n \"platform\": \"Win32\"\r\n },\r\n \"tags\": [\r\n \"tag1\",\r\n \"tag 2\",\r\n \"tag-3\"\r\n ],\r\n \"userCustomData\": {\r\n \"domain\": \"WORKPLACE\",\r\n \"area\": \"51\"\r\n },\r\n \"request\": {\r\n \"hostName\": \"https://raygun.io\",\r\n \"url\": \"/documentation/integrations/api\",\r\n \"httpMethod\": \"POST\",\r\n \"iPAddress\": \"127.0.0.1\",\r\n \"queryString\": {\r\n \"q\": \"searchParams\"\r\n },\r\n \"form\": {\r\n \"firstName\": \"Example\",\r\n \"lastName\": \"Person\",\r\n \"newsletter\": true\r\n },\r\n \"headers\": {\r\n \"Referer\": \"www.google.com\",\r\n \"Host\": \"raygun.io\"\r\n },\r\n \"rawData\": \"{\\\"Test\\\": 5}\"\r\n },\r\n \"response\": {\r\n \"statusCode\": 500\r\n },\r\n \"user\": {\r\n \"identifier\": \"123456789\",\r\n \"isAnonymous\": false,\r\n \"email\": \"test@example.com\",\r\n \"fullName\": \"Test User\",\r\n \"firstName\": \"Test\",\r\n \"uuid\": \"783491e1-d4a9-46bc-9fde-9b1dd9ef6c6e\"\r\n },\r\n \"breadcrumbs\": [\r\n {\r\n \"timeStamp\": 1504799959639,\r\n \"level\": \"info\",\r\n \"type\": \"navigation\",\r\n \"category\": \"checkout\",\r\n \"message\": \"User navigated to the shopping cart\",\r\n \"className\": \"ShoppingCart\",\r\n \"methodName\": \"ViewBasket\",\r\n \"lineNumber\": 156,\r\n \"customData\": {\r\n \"from\": \"/category/product/123\",\r\n \"to\": \"/cart/view\"\r\n }\r\n }\r\n ]\r\n }\r\n}";
- private JsonSerializerOptions jsonSerializerOptions = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase, };
+ private const string ApiDocsPayload = "{\r\n \"occurredOn\": \"2015-09-08T01:55:28Z\",\r\n \"details\": {\r\n \"machineName\": \"ServerMachine1\",\r\n \"groupingKey\": \"ErrorGroup\",\r\n \"version\": \"1.0.0.1\",\r\n \"client\": {\r\n \"name\": \"Example Raygun Client\",\r\n \"version\": \"0.0.0.1\",\r\n \"clientUrl\": \"/documentation/integrations/api\"\r\n },\r\n \"error\": {\r\n \"innerError\": {},\r\n \"data\": {\r\n \"example\": 5\r\n },\r\n \"className\": \"ErrorClass\",\r\n \"message\": \"An error occurred\",\r\n \"stackTrace\": [\r\n {\r\n \"lineNumber\": 55,\r\n \"className\": \"BrokenService\",\r\n \"columnNumber\": 23,\r\n \"fileName\": \"BrokenService.cs\",\r\n \"methodName\": \"BreakEverything()\"\r\n }\r\n ]\r\n },\r\n \"environment\": {\r\n \"processorCount\": 4,\r\n \"osVersion\": \"Windows 10\",\r\n \"windowBoundsWidth\": 2560,\r\n \"windowBoundsHeight\": 1440,\r\n \"browser-Width\": 2560,\r\n \"browser-Height\": 1440,\r\n \"screen-Width\": 2560,\r\n \"screen-Height\": 1440,\r\n \"resolutionScale\": 1,\r\n \"color-Depth\": 24,\r\n \"currentOrientation\": \"Landscape\",\r\n \"cpu\": \"Intel(R) Core(TM) i5-2500 CPU @ 3.30GHz\",\r\n \"packageVersion\": \"package version\",\r\n \"architecture\": \"ARMv7-A\",\r\n \"deviceManufacturer\": \"Nokia\",\r\n \"model\": \"Lumia 920\",\r\n \"totalPhysicalMemory\": 1024,\r\n \"availablePhysicalMemory\": 500,\r\n \"totalVirtualMemory\": 500,\r\n \"availableVirtualMemory\": 500,\r\n \"diskSpaceFree\": [\r\n 50000.52,\r\n 2000.104\r\n ],\r\n \"deviceName\": \"Nexus 7\",\r\n \"locale\": \"en-nz\",\r\n \"utcOffset\": -12,\r\n \"browser\": \"Mozilla\",\r\n \"browserName\": \"Netscape\",\r\n \"browser-Version\": \"5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.65 Safari/537.36\",\r\n \"platform\": \"Win32\"\r\n },\r\n \"tags\": [\r\n \"tag1\",\r\n \"tag 2\",\r\n \"tag-3\"\r\n ],\r\n \"userCustomData\": {\r\n \"domain\": \"WORKPLACE\",\r\n \"area\": \"51\"\r\n },\r\n \"request\": {\r\n \"hostName\": \"https://raygun.io\",\r\n \"url\": \"/documentation/integrations/api\",\r\n \"httpMethod\": \"POST\",\r\n \"iPAddress\": \"127.0.0.1\",\r\n \"queryString\": {\r\n \"q\": \"searchParams\"\r\n },\r\n \"form\": {\r\n \"firstName\": \"Example\",\r\n \"lastName\": \"Person\",\r\n \"newsletter\": true\r\n },\r\n \"headers\": {\r\n \"Referer\": \"www.google.com\",\r\n \"Host\": \"raygun.io\"\r\n },\r\n \"rawData\": \"{\\\"Test\\\": 5}\"\r\n },\r\n \"response\": {\r\n \"statusCode\": 500\r\n },\r\n \"user\": {\r\n \"identifier\": \"123456789\",\r\n \"isAnonymous\": false,\r\n \"email\": \"test@example.com\",\r\n \"fullName\": \"Test User\",\r\n \"firstName\": \"Test\",\r\n \"uuid\": \"783491e1-d4a9-46bc-9fde-9b1dd9ef6c6e\"\r\n },\r\n \"breadcrumbs\": [\r\n {\r\n \"timeStamp\": 1504799959639,\r\n \"level\": \"info\",\r\n \"type\": \"navigation\",\r\n \"category\": \"checkout\",\r\n \"message\": \"User navigated to the shopping cart\",\r\n \"className\": \"ShoppingCart\",\r\n \"methodName\": \"ViewBasket\",\r\n \"lineNumber\": 156,\r\n \"customData\": {\r\n \"from\": \"/category/product/123\",\r\n \"to\": \"/cart/view\"\r\n }\r\n }\r\n ]\r\n }\r\n}";
+ private readonly JsonSerializerOptions _jsonSerializerOptions = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase, };
#endregion
@@ -29,7 +29,7 @@ public class SerializationTests
[TestMethod]
public void ApiDocsPayload_ShouldDeserialize()
{
- var result = JsonSerializer.Deserialize(apiDocsPayload, jsonSerializerOptions);
+ var result = JsonSerializer.Deserialize(ApiDocsPayload, _jsonSerializerOptions);
result.Should().NotBeNull();
result.OccurredOn.Should().Be(new DateTime(2015, 09, 08, 01, 55, 28, DateTimeKind.Utc));
result.Details.Should().NotBeNull();
diff --git a/src/Raygun.NetCore.Tests.Blazor/appsettings.json b/src/Raygun.NetCore.Tests.Blazor/appsettings.json
index 7f9e600..598ca55 100644
--- a/src/Raygun.NetCore.Tests.Blazor/appsettings.json
+++ b/src/Raygun.NetCore.Tests.Blazor/appsettings.json
@@ -1,4 +1,5 @@
{
"Raygun": {
+ "ApiKey": "APIKEY"
}
}