Let IConnection implement ITestInstance, then we can clean some stuff up.

This commit is contained in:
Martin Baulig 2015-03-05 01:37:26 +01:00
Родитель 6f7e424fe4
Коммит 0790baca4f
4 изменённых файлов: 32 добавлений и 2 удалений

Просмотреть файл

@ -109,6 +109,34 @@ namespace Mono.Security.Instrumentation.Framework
Console.WriteLine ("[{0}]: {1}", GetType ().Name, string.Format (message, args));
}
#region ITestInstance implementation
public async Task Initialize (TestContext ctx, CancellationToken cancellationToken)
{
ctx.LogMessage ("Initialize: {0}", this);
await Start (ctx, cancellationToken);
ctx.LogMessage ("Initialize #1: {0}", this);
}
public Task PreRun (TestContext ctx, CancellationToken cancellationToken)
{
return FinishedTask;
}
public Task PostRun (TestContext ctx, CancellationToken cancellationToken)
{
return FinishedTask;
}
public Task Destroy (TestContext ctx, CancellationToken cancellationToken)
{
return Task.Run (() => {
Dispose ();
});
}
#endregion
public void Dispose ()
{
Dispose (true);

Просмотреть файл

@ -31,7 +31,7 @@ using Xamarin.AsyncTests;
namespace Mono.Security.NewTls.TestFramework
{
public interface IConnection : IDisposable
public interface IConnection : ITestInstance, IDisposable
{
bool SupportsCleanShutdown {
get;

Просмотреть файл

@ -23,6 +23,8 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using Xamarin.AsyncTests;
namespace Mono.Security.NewTls.TestFramework
{
public interface IServer : ICommonConnection

Просмотреть файл

@ -11,7 +11,7 @@ using Xamarin.AsyncTests;
namespace Mono.Security.NewTls.TestProvider
{
public abstract class Connection : IConnection, ITestInstance, IDisposable
public abstract class Connection : IConnection, IDisposable
{
public abstract bool SupportsCleanShutdown {
get;