Skip to content

Commit

Permalink
Autofac likes the DisposeAsync feels
Browse files Browse the repository at this point in the history
  • Loading branch information
phatboyg committed May 19, 2020
1 parent cb9e9d5 commit 848b5bf
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace MassTransit.Containers.Tests.Autofac_Tests
{
using System.Threading.Tasks;
using Autofac;
using Common_Tests;
using Monitoring.Health;
Expand All @@ -21,9 +22,9 @@ public Autofac_Conductor(bool instanceEndpoint)
}

[OneTimeTearDown]
public void Close_container()
public async Task Close_container()
{
_container.Dispose();
await _container.DisposeAsync();
}

protected override void ConfigureServiceEndpoints(IReceiveConfigurator<IInMemoryReceiveEndpointConfigurator> configurator)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public Autofac_Consumer()
}

[OneTimeTearDown]
public void Close_container()
public async Task Close_container()
{
_container.Dispose();
await _container.DisposeAsync();
}

protected override IRegistration Registration => _container.Resolve<IRegistration>();
Expand Down Expand Up @@ -93,9 +93,9 @@ public Autofac_Consumer_ServiceEndpoint()
}

[OneTimeTearDown]
public void Close_container()
public async Task Close_container()
{
_container.Dispose();
await _container.DisposeAsync();
}

protected override IRegistration Registration => _container.Resolve<IRegistration>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
// Copyright 2007-2019 Chris Patterson, Dru Sellers, Travis Smith, et. al.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
namespace MassTransit.Containers.Tests.Autofac_Tests
{
using System;
Expand Down Expand Up @@ -39,9 +27,9 @@ public AutofacCourier_ExecuteActivity()
}

[OneTimeTearDown]
public void Close_container()
public async Task Close_container()
{
_container.Dispose();
await _container.DisposeAsync();
}

protected override IRegistration Registration => _container.Resolve<IRegistration>();
Expand Down Expand Up @@ -69,9 +57,9 @@ public AutofacCourier_ExecuteActivity_Endpoint()
}

[OneTimeTearDown]
public void Close_container()
public async Task Close_container()
{
_container.Dispose();
await _container.DisposeAsync();
}

protected override IRegistration Registration => _container.Resolve<IRegistration>();
Expand All @@ -97,9 +85,9 @@ public AutofacCourier_Activity()
}

[OneTimeTearDown]
public void Close_container()
public async Task Close_container()
{
_container.Dispose();
await _container.DisposeAsync();
}

protected override IRegistration Registration => _container.Resolve<IRegistration>();
Expand Down Expand Up @@ -127,9 +115,9 @@ public AutofacCourier_Activity_Endpoint()
}

[OneTimeTearDown]
public void Close_container()
public async Task Close_container()
{
_container.Dispose();
await _container.DisposeAsync();
}

protected override IRegistration Registration => _container.Resolve<IRegistration>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace MassTransit.Containers.Tests.Autofac_Tests
{
using System;
using System.Threading.Tasks;
using Autofac;
using Common_Tests;
using Common_Tests.Discovery;
Expand Down Expand Up @@ -36,9 +37,9 @@ public Autofac_Discovery()
protected override IRegistration Registration => _container.Resolve<IRegistration>();

[OneTimeTearDown]
public void Close_container()
public async Task Close_container()
{
_container.Dispose();
await _container.DisposeAsync();
}

protected override IRequestClient<PingMessage> GetRequestClient()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace MassTransit.Containers.Tests.Autofac_Tests
{
using System.Threading.Tasks;
using Autofac;
using Common_Tests;
using Mediator;
Expand All @@ -21,9 +22,9 @@ public Autofac_Mediator()
}

[OneTimeTearDown]
public void Close_container()
public async Task Close_container()
{
_container.Dispose();
await _container.DisposeAsync();
}

protected override IMediator Mediator => _container.Resolve<IMediator>();
Expand All @@ -44,9 +45,9 @@ public Autofac_Mediator_Request()
}

[OneTimeTearDown]
public void Close_container()
public async Task Close_container()
{
_container.Dispose();
await _container.DisposeAsync();
}

protected override IRequestClient<T> GetRequestClient<T>()
Expand All @@ -71,9 +72,9 @@ public Autofac_Mediator_Saga()
}

[OneTimeTearDown]
public void Close_container()
public async Task Close_container()
{
_container.Dispose();
await _container.DisposeAsync();
}

protected override IMediator Mediator => _container.Resolve<IMediator>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace MassTransit.Containers.Tests.Autofac_Tests
{
using System.Threading.Tasks;
using Autofac;
using Common_Tests;
using NUnit.Framework;
Expand Down Expand Up @@ -34,9 +35,9 @@ public Autofac_RequestClient_Context()
}

[OneTimeTearDown]
public void Close_container()
public async Task Close_container()
{
_container.Dispose();
await _container.DisposeAsync();
}

protected override IRequestClient<InitialRequest> RequestClient => _container.Resolve<IRequestClient<InitialRequest>>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace MassTransit.Containers.Tests.Autofac_Tests
{
using System.Threading.Tasks;
using Autofac;
using Common_Tests;
using NUnit.Framework;
Expand All @@ -21,9 +22,9 @@ public Autofac_Saga()
protected override IRegistration Registration => _container.Resolve<IRegistration>();

[OneTimeTearDown]
public void Close_container()
public async Task Close_container()
{
_container.Dispose();
await _container.DisposeAsync();
}

protected override ISagaRepository<T> GetSagaRepository<T>()
Expand All @@ -48,9 +49,9 @@ public Autofac_Saga_Endpoint()
protected override IRegistration Registration => _container.Resolve<IRegistration>();

[OneTimeTearDown]
public void Close_container()
public async Task Close_container()
{
_container.Dispose();
await _container.DisposeAsync();
}

protected override ISagaRepository<T> GetSagaRepository<T>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public Autofac_SagaStateMachine()
}

[OneTimeTearDown]
public void Close_container()
public async Task Close_container()
{
_container.Dispose();
await _container.DisposeAsync();
}

protected override IRegistration Registration => _container.Resolve<IRegistration>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace MassTransit.Containers.Tests.Autofac_Tests
{
using System.Threading.Tasks;
using Autofac;
using Common_Tests;
using NUnit.Framework;
Expand All @@ -23,9 +24,9 @@ public Autofac_Scope()
}

[OneTimeTearDown]
public void Close_container()
public async Task Close_container()
{
_container.Dispose();
await _container.DisposeAsync();
}

protected override ISendEndpointProvider GetSendEndpointProvider()
Expand Down

0 comments on commit 848b5bf

Please sign in to comment.