Skip to content

Commit

Permalink
Use GetAdaptedSession consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmarbach committed Sep 1, 2022
1 parent b693bac commit ddf8e7b
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
namespace NServiceBus.AcceptanceTests.Reliability.SynchronizedStorage
{
using System.Reflection;
using System.Threading.Tasks;
using AcceptanceTesting;
using EndpointTemplates;
Expand Down Expand Up @@ -66,22 +65,18 @@ protected override async Task OnStart(IMessageSession session)
using (var completableSynchronizedStorageSession =
childBuilder.Build<CompletableSynchronizedStorageSession>())
{
PropertyInfo propertyInfo = completableSynchronizedStorageSession.GetType()
.GetProperty("AdaptedSession");

scenarioContext.AdaptedSessionIsNullBeforeOpening =
propertyInfo.GetValue(completableSynchronizedStorageSession) == null;
completableSynchronizedStorageSession.GetAdaptedSession() == null;

await completableSynchronizedStorageSession.Open(new ContextBag());

scenarioContext.AdaptedSessionNotNullAfterOpening =
propertyInfo.GetValue(completableSynchronizedStorageSession) != null;
completableSynchronizedStorageSession.GetAdaptedSession() != null;

var synchronizedStorage = childBuilder.Build<SynchronizedStorageSession>();

scenarioContext.StorageSessionEqual =
propertyInfo
.GetValue(completableSynchronizedStorageSession)
completableSynchronizedStorageSession.GetAdaptedSession()
.Equals(synchronizedStorage);

await completableSynchronizedStorageSession.CompleteAsync();
Expand Down

0 comments on commit ddf8e7b

Please sign in to comment.