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

Port to Xunit #52

Closed
wants to merge 58 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
a38abc3
Add xunit and Xunit.SkippableFact, replace [Test] with [SkippableFact]
Arkatufus Aug 21, 2020
14ecb1d
Replace IgnoreException with SkipException
Arkatufus Aug 21, 2020
e2c1ae3
Replace `Assert.Ignore` with `TckAssert.Skip` and `Assert.Fail` with …
Arkatufus Aug 21, 2020
6e56e66
replace Assert functions to the equivalent version in Xunit
Arkatufus Aug 21, 2020
56e9f3e
Add `Assert.Fail` and `Assert.Ignore` support
Arkatufus Aug 21, 2020
08db990
Remove TextFixtureAttribute
Arkatufus Aug 21, 2020
ce6f42e
Add ITestOutputHelper support
Arkatufus Aug 21, 2020
72e080b
Fix OptionalActivePublisherTest, it was eating all exceptions
Arkatufus Aug 21, 2020
d484a57
Turn on netcoreapp3.1 testing
Arkatufus Aug 21, 2020
1c4a538
Update build script to dotnet 3.1.105 LTS, add RunTestsDotNet build args
Arkatufus Aug 21, 2020
feb6247
Merge branch 'master' into Update_to_Xunit
Arkatufus May 17, 2021
d9b05e3
Update framework targets and package versions
Arkatufus May 17, 2021
3e2e02f
Add xunit and Xunit.SkippableFact, replace [Test] with [SkippableFact]
Arkatufus Aug 21, 2020
2c21b07
Replace IgnoreException with SkipException
Arkatufus Aug 21, 2020
4c56cd0
Replace `Assert.Ignore` with `TckAssert.Skip` and `Assert.Fail` with …
Arkatufus Aug 21, 2020
9fa653e
replace Assert functions to the equivalent version in Xunit
Arkatufus Aug 21, 2020
a6cb650
Add `Assert.Fail` and `Assert.Ignore` support
Arkatufus Aug 21, 2020
5b50b7b
Remove TextFixtureAttribute
Arkatufus Aug 21, 2020
ab53717
Add ITestOutputHelper support
Arkatufus Aug 21, 2020
49fd87e
Fix OptionalActivePublisherTest, it was eating all exceptions
Arkatufus Aug 21, 2020
044a695
Turn on netcoreapp3.1 testing
Arkatufus Aug 21, 2020
3a7436a
Update build script to dotnet 3.1.105 LTS, add RunTestsDotNet build args
Arkatufus Aug 21, 2020
3a85e83
Added me to relicensing file
marcpiechura Aug 19, 2020
de965e7
Signed relicensing doc
cconstantin Aug 20, 2020
a5466f9
Update Relicensing.txt
alexvaluyskiy Sep 9, 2020
1093ff0
Port NUnit to XUnit, update target frameworks to netstandard2.0 and n…
viktorklang Oct 29, 2020
635332b
Update framework targets and package versions
Arkatufus May 17, 2021
b566ecf
Merge branch 'Update_to_Xunit' of github.com:Arkatufus/reactive-strea…
Arkatufus May 17, 2021
94e485b
Added copyright
alexvaluyskiy Mar 14, 2017
abd4803
Fix missing Cancel() in tests that don't consume the entire source (#32)
akarnokd Mar 27, 2017
c0225ec
Update CopyrightWaivers.txt
akarnokd Mar 18, 2017
83730c7
Skip §2.13 for value types (#34)
Apr 1, 2017
d45bfa5
fail if timeout is reached
marcpiechura Apr 1, 2017
2b34b05
1.0.0 stable release (#28)
Apr 5, 2017
36ebf21
bump version
Apr 7, 2017
5d687fc
Add the 'I' prefix to component names
akarnokd Apr 5, 2017
d8964c0
Update AsyncSubscriber.cs
Megasware128 Jun 29, 2017
dac6326
Added xml documentation (#42)
alexvaluyskiy Aug 8, 2017
a819a0e
Preparing for relicensing to MIT-0
viktorklang Aug 12, 2020
785397d
Update Relicensing.txt
akarnokd Aug 12, 2020
b68530b
Add xunit and Xunit.SkippableFact, replace [Test] with [SkippableFact]
Arkatufus Aug 21, 2020
fbf7f35
Replace IgnoreException with SkipException
Arkatufus Aug 21, 2020
39d5b7b
Replace `Assert.Ignore` with `TckAssert.Skip` and `Assert.Fail` with …
Arkatufus Aug 21, 2020
463a68c
replace Assert functions to the equivalent version in Xunit
Arkatufus Aug 21, 2020
380a841
Add `Assert.Fail` and `Assert.Ignore` support
Arkatufus Aug 21, 2020
f43349c
Remove TextFixtureAttribute
Arkatufus Aug 21, 2020
7fd7136
Add ITestOutputHelper support
Arkatufus Aug 21, 2020
5ff3cba
Fix OptionalActivePublisherTest, it was eating all exceptions
Arkatufus Aug 21, 2020
bc73d6b
Turn on netcoreapp3.1 testing
Arkatufus Aug 21, 2020
79008d1
Update build script to dotnet 3.1.105 LTS, add RunTestsDotNet build args
Arkatufus Aug 21, 2020
07b7f26
Added me to relicensing file
marcpiechura Aug 19, 2020
b9fb096
Signed relicensing doc
cconstantin Aug 20, 2020
5ec79c5
Update Relicensing.txt
alexvaluyskiy Sep 9, 2020
2ff6255
Port NUnit to XUnit, update target frameworks to netstandard2.0 and n…
viktorklang Oct 29, 2020
68ef99a
Update framework targets and package versions
Arkatufus May 17, 2021
b45555b
Add xunit and Xunit.SkippableFact, replace [Test] with [SkippableFact]
Arkatufus Aug 21, 2020
9c99de1
Merge branch 'Update_to_Xunit' of github.com:Arkatufus/reactive-strea…
Arkatufus May 17, 2021
16412fd
Update target frameworks
Arkatufus May 17, 2021
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
47 changes: 47 additions & 0 deletions src/tck/Reactive.Streams.TCK/Support/AssertionException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Reactive.Streams.TCK.Support
{
/// <summary>
/// Thrown when an assertion failed.
/// </summary>
[Serializable]
public class AssertionException : Exception
{
/// <param name="message">The error message that explains
/// the reason for the exception</param>
public AssertionException(string message) : base(message)
{ }

/// <param name="message">The error message that explains
/// the reason for the exception</param>
/// <param name="inner">The exception that caused the
/// current exception</param>
public AssertionException(string message, Exception inner) :
base(message, inner)
{ }

#if SERIALIZATION
/// <summary>
/// Serialization Constructor
/// </summary>
protected AssertionException(System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) : base(info,context)
{}
#endif

/*
/// <summary>
/// Gets the ResultState provided by this exception
/// </summary>
public override ResultState ResultState
{
get { return ResultState.Failure; }
}
*/
}
}
95 changes: 95 additions & 0 deletions src/tck/Reactive.Streams.TCK/Support/TckAssert.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;

namespace Reactive.Streams.TCK.Support
{
public static class TckAssert
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This static class is added to add Assert.Ignore (renamed to Skip) and Assert.Fail convenience static methods

{
#region Fail

/// <summary>
/// Throws an <see cref="AssertionException"/> with the message and arguments
/// that are passed in. This is used by the other Assert functions.
/// </summary>
/// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
/// <param name="args">Arguments to be used in formatting the message</param>
public static void Fail(string message, params object[] args)
{
if (message == null) message = string.Empty;
else if (args != null && args.Length > 0)
message = string.Format(message, args);

throw new AssertionException(message);
//ReportFailure(message);
}

/// <summary>
/// Throws an <see cref="AssertionException"/> with the message that is
/// passed in. This is used by the other Assert functions.
/// </summary>
/// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
public static void Fail(string message)
{
Fail(message, null);
}

/// <summary>
/// Throws an <see cref="AssertionException"/>.
/// This is used by the other Assert functions.
/// </summary>
public static void Fail()
{
Fail(string.Empty, null);
}

#endregion

#region Skip

/// <summary>
/// Throws an <see cref="SkipException"/> with the message and arguments
/// that are passed in. This causes the test to be reported as ignored.
/// </summary>
/// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
/// <param name="args">Arguments to be used in formatting the message</param>
public static void Skip(string message, params object[] args)
{
if (message == null) message = string.Empty;
else if (args != null && args.Length > 0)
message = string.Format(message, args);

/*
// If we are in a multiple assert block, this is an error
if (TestExecutionContext.CurrentContext.MultipleAssertLevel > 0)
throw new Exception("Assert.Ignore may not be used in a multiple assertion block.");
*/

throw new SkipException(message);
}

/// <summary>
/// Throws an <see cref="SkipException"/> with the message that is
/// passed in. This causes the test to be reported as ignored.
/// </summary>
/// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
public static void Skip(string message)
{
Skip(message, null);
}

/// <summary>
/// Throws an <see cref="SkipException"/>.
/// This causes the test to be reported as ignored.
/// </summary>
public static void Skip()
{
Skip(string.Empty, null);
}

#endregion
}
}