-
Notifications
You must be signed in to change notification settings - Fork 934
NH-3905 - Missings async tests #683
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
NH-3905 - Missings async tests #683
Conversation
@@ -156,8 +156,6 @@ | |||
applyChanges: true | |||
analyzation: | |||
methodConversion: | |||
- conversion: Ignore | |||
hasAttributeName: IgnoreAttribute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See review.
@@ -7,5 +7,5 @@ | |||
<package id="NUnit.Extension.NUnitV2ResultWriter" version="3.6.0" targetFramework="net461" /> | |||
<package id="NUnit.Extension.TeamCityEventListener" version="1.0.2" targetFramework="net461" /> | |||
<package id="NUnit.Extension.VSProjectLoader" version="3.6.0" targetFramework="net461" /> | |||
<package id="CSharpAsyncGenerator.CommandLine" version="0.3.6" targetFramework="net461" /> | |||
<package id="CSharpAsyncGenerator.CommandLine" version="0.4.0" targetFramework="net461" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -156,8 +156,6 @@ | |||
applyChanges: true | |||
analyzation: | |||
methodConversion: | |||
- conversion: Ignore | |||
hasAttributeName: IgnoreAttribute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rule was causing tests from a base class overridden for marking them as NUnit [Ignored]
to have their override ignored by async generator, thus having their async counterpart NUnit executed instead of being ignored.
Example of such a case in this fixture.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
@@ -180,6 +178,8 @@ | |||
hasAttributeName: IgnoreAttribute | |||
- conversion: NewType | |||
hasAttributeName: TestFixtureAttribute | |||
- conversion: NewType | |||
anyBaseTypeRule: HasTestFixtureAttribute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required for generating child classes of a base fixture if they are not themselves marked with the [Fixture]
attribute.
@@ -8,6 +8,7 @@ | |||
|
|||
namespace NHibernate.Test.Events.Collections | |||
{ | |||
[TestFixture] | |||
public abstract class AbstractCollectionEventFixture : TestCase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With current generation rules, it is required to flag a base class with [TextFixture]
if it defines tests potentially needing an async counterpart.
@@ -5,6 +5,7 @@ | |||
|
|||
namespace NHibernate.Test.CfgTest | |||
{ | |||
[TestFixture] | |||
public class AccessorsSerializableTest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Async counterparts are currently generated only for classes marked with TestFixture
. Lacking it causes the fixture to be ignored. I have added the attribute on all fixture defining tests and lacking it.
Since this attribute is no more needed by NUnit, we are effectively using it as a kind of GenerateAsync
attribute...
We could add our own specific attribute for that and replace all TextFixture
by it. It would be more explicit.
@@ -158,6 +160,15 @@ public override void OnInitializeCollection(InitializeCollectionEvent @event) | |||
base.OnInitializeCollection(@event); | |||
AddEvent(@event, this); | |||
} | |||
|
|||
public override Task OnInitializeCollectionAsync(InitializeCollectionEvent @event, CancellationToken cancellationToken) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Async generator does not currently generates async counterparts for overrides of synchronous methods. See #46. Some other test classes are affected and fixed too.
return result; | ||
} | ||
|
||
public override Task<DbCommand> PrepareBatchCommandAsync(CommandType type, SqlString sql, SqlType[] parameterTypes, CancellationToken cancellationToken) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bunch of missing async override counterparts here too.
// the list contains at least one Cat then should Throws | ||
Assert.That(() => query.ToList(), Throws.Exception); | ||
// Do not use bare Throws.Exception due to https://github.com/nunit/nunit/issues/1899 | ||
Assert.That(() => list = query.ToList(), Throws.InstanceOf<GenericADOException>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -104,6 +107,12 @@ public override DbDataReader ExecuteReader(DbCommand cmd) | |||
LastCommandTimeout = cmd.CommandTimeout; | |||
return base.ExecuteReader(cmd); | |||
} | |||
|
|||
public override Task<DbDataReader> ExecuteReaderAsync(DbCommand cmd, CancellationToken cancellationToken) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, missing async counterpart otherwise.
NH-3905 - Due to various reasons, a bunch of tests were not having their async counterparts generated.