Skip to content

Commit

Permalink
feat: Add xunit v3 markers
Browse files Browse the repository at this point in the history
  • Loading branch information
linkdotnet committed Jan 10, 2025
1 parent bcc7469 commit 77f81e5
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/bunit.core/Asserting/ActualExpectedAssertException.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using Bunit.Internal.XUnitExceptions;

namespace Bunit.Asserting;

/// <summary>
/// Represents a generic assert exception used when an actual result does not match an expected result.
/// </summary>
[Serializable]
public class ActualExpectedAssertException : Exception
public class ActualExpectedAssertException : Exception, IAssertionException
{
/// <summary>
/// Initializes a new instance of the <see cref="ActualExpectedAssertException"/> class.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using Bunit.Internal.XUnitExceptions;

namespace Bunit.Extensions.WaitForHelpers;

/// <summary>
/// Represents an exception thrown when the <see cref="WaitForHelper{T}"/> does not complete successfully.
/// </summary>
[Serializable]
public sealed class WaitForFailedException : Exception
public sealed class WaitForFailedException : Exception, ITestTimeoutException
{
/// <summary>
/// Initializes a new instance of the <see cref="WaitForFailedException"/> class.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Bunit.Internal.XUnitExceptions;

/// <summary>
/// This is a marker interface for xUnit.v3 that will cause xUnit to consider the failure cause to be an assertion failure.
/// </summary>
internal interface IAssertionException;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Bunit.Internal.XUnitExceptions;

/// <summary>
/// This is a marker interface for xUnit.v3 that will cause xUnit to consider the failure cause to be a timeout.
/// </summary>
internal interface ITestTimeoutException;
2 changes: 1 addition & 1 deletion src/bunit.core/ParameterException.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Bunit.RazorTesting;

/// <summary>
/// Represents an missing or invalid Blazor parameter on a Blazor component.
/// Represents a missing or invalid Blazor parameter on a Blazor component.
/// </summary>
[Serializable]
public sealed class ParameterException : ArgumentException
Expand Down
2 changes: 1 addition & 1 deletion src/bunit.web/Extensions/ElementRemovedFromDomException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace Bunit;

/// <summary>
/// Represents an exception that is thrown when trying to access an element
/// that was previous found in the DOM.
/// that was previously found in the DOM.
/// </summary>
[Serializable]
public sealed class ElementRemovedFromDomException : ElementNotFoundException
Expand Down

0 comments on commit 77f81e5

Please sign in to comment.