mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-05 04:39:08 +08:00
Modified the test, the connection need not be null after being disposed. There is no direct way of checking if an object has been disposed other than to throw the InvalidOperationException
This commit is contained in:
parent
a5ce2a5a62
commit
bb16313024
@ -132,14 +132,33 @@ namespace Wox.Test.Plugins
|
||||
_api.InitQueryHelper(out queryHelper, 10);
|
||||
_api.ModifyQueryHelper(ref queryHelper, "*");
|
||||
string keyword = "test";
|
||||
bool commandDisposed = false;
|
||||
bool resultDisposed = false;
|
||||
|
||||
// Act
|
||||
_api.ExecuteQuery(queryHelper, keyword);
|
||||
try
|
||||
{
|
||||
_api.command.ExecuteReader();
|
||||
}
|
||||
catch(InvalidOperationException)
|
||||
{
|
||||
commandDisposed = true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_api.WDSResults.Read();
|
||||
}
|
||||
catch(InvalidOperationException)
|
||||
{
|
||||
resultDisposed = true;
|
||||
}
|
||||
|
||||
// Assert
|
||||
Assert.IsNull(_api.conn);
|
||||
Assert.IsNull(_api.command);
|
||||
Assert.IsNull(_api.WDSResults);
|
||||
Assert.IsTrue(_api.conn.State == System.Data.ConnectionState.Closed);
|
||||
Assert.IsTrue(commandDisposed);
|
||||
Assert.IsTrue(resultDisposed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user