Conversation
|
@jfversluis Could you take a look at why the PR Feed is failing? |
pictos
left a comment
There was a problem hiding this comment.
I've just two comments here, but I think that doesn't block this PR
|
|
||
| public void Dispose() | ||
| { | ||
| GC.SuppressFinalize(this); |
There was a problem hiding this comment.
This is something that I'm not 100% sure about, should we call this method just if we implement the destructor (`~ BaseTest() {}`)?
There was a problem hiding this comment.
I added IDisposible because it is recommended by Xunit as the replacement for [TearDown] in Nunit:
https://xunit.net/docs/comparisons
There was a problem hiding this comment.
Other tests that also want to include [TearDown] code can override protected virtual void Dispose(bool isDisposing)
public class ExampleTest : BaseTest
{
[Fact]
public void ExampleTest()
{
// Test code
}
protected override void Dispose(bool isDisposing)
{
// Teardown test
base.Dispose(isDisposing);
}
}There was a problem hiding this comment.
I'm sorry, I was talking about the GC.SuppressFinalize(this); It's fine to implement the Dispose method without that GC method, I guess. As I mentioned I need to review the pattern, but this shouldn't be a blocker anyway.
There was a problem hiding this comment.
Ah - gotchya.
Yea, GC.SupressFinalize was new to me too!
I found it recommended in the docs: https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-dispose#the-dispose-method
This one should be fixed from here on out! |


Description
Migrating to Xunit is the first step towards adding Device Tests to the MAUI Community Toolkit.
To run Device Tests, XHarness is required, which uses Xunit. Writing both device and non-device unit tests with Xunit also allows us to re-use code between the testing projects.
Note: There is a known-issue with using
dotnet testwith a Unit Test that also includes `true in its csproj. The .NET MAUI team is aware of this and are targeting a fix for .NET MAUI Preview 10 in November.Details
[Test]->[Fact]Directory.Build.targetstesthost.runtimeconfig.jsonwas not included in thebinoutputDirectory.Build.targetswas only necessary in earlier previews of .NET MAUI