Skip to content

Commit

Permalink
Adapt tests to v7.8
Browse files Browse the repository at this point in the history
  • Loading branch information
mauroservienti committed Nov 24, 2022
1 parent dae4ade commit d20902a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,17 @@ public async Task Save_should_fail_when_data_changes_between_read_and_update()
var generatedSagaId = sagaData.Id;

ContextBag losingContext;
ICompletableSynchronizedStorageSession losingSaveSession;
CompletableSynchronizedStorageSession losingSaveSession;
TestSagaData staleRecord;
var persister = configuration.SagaStorage;

var winningContext = configuration.GetContextBagForSagaStorage();
using (var winningSaveSession = configuration.CreateStorageSession())
using (var winningSaveSession = await configuration.SynchronizedStorage.OpenSession(winningContext))
{
await winningSaveSession.Open(winningContext);

var record = await persister.Get<TestSagaData>(generatedSagaId, winningSaveSession, winningContext);

losingContext = configuration.GetContextBagForSagaStorage();
losingSaveSession = configuration.CreateStorageSession();
await losingSaveSession.Open(losingContext);
losingSaveSession = await configuration.SynchronizedStorage.OpenSession(losingContext);
staleRecord = await persister.Get<TestSagaData>("SomeId", correlationPropertyData, losingSaveSession, losingContext);

record.DateTimeProperty = DateTime.UtcNow;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,19 @@ public async Task Save_process_is_repeatable()
await SaveSaga(saga);

ContextBag losingContext1;
ICompletableSynchronizedStorageSession losingSaveSession1;
CompletableSynchronizedStorageSession losingSaveSession1;
TestSagaData staleRecord1;
var persister = configuration.SagaStorage;

var winningContext1 = configuration.GetContextBagForSagaStorage();
var winningSaveSession1 = configuration.CreateStorageSession();
await winningSaveSession1.Open(winningContext1);
var winningSaveSession1 = await configuration.SynchronizedStorage.OpenSession(winningContext1);

try
{
var record1 = await persister.Get<TestSagaData>(saga.Id, winningSaveSession1, winningContext1);

losingContext1 = configuration.GetContextBagForSagaStorage();
losingSaveSession1 = configuration.CreateStorageSession();
await losingSaveSession1.Open(losingContext1);
losingSaveSession1 = await configuration.SynchronizedStorage.OpenSession(losingContext1);

staleRecord1 = await persister.Get<TestSagaData>("SomeId", correlationPropertyData, losingSaveSession1, losingContext1);

Expand Down Expand Up @@ -60,19 +58,17 @@ public async Task Save_process_is_repeatable()
}

ContextBag losingContext2;
ICompletableSynchronizedStorageSession losingSaveSession2;
CompletableSynchronizedStorageSession losingSaveSession2;
TestSagaData staleRecord2;

var winningContext2 = configuration.GetContextBagForSagaStorage();
var winningSaveSession2 = configuration.CreateStorageSession();
await winningSaveSession2.Open(winningContext2);
var winningSaveSession2 = await configuration.SynchronizedStorage.OpenSession(winningContext2);
try
{
var record2 = await persister.Get<TestSagaData>(saga.Id, winningSaveSession2, winningContext2);

losingContext2 = configuration.GetContextBagForSagaStorage();
losingSaveSession2 = configuration.CreateStorageSession();
await losingSaveSession2.Open(losingContext2);
losingSaveSession2 = await configuration.SynchronizedStorage.OpenSession(losingContext2);

staleRecord2 = await persister.Get<TestSagaData>("SomeId", correlationPropertyData, losingSaveSession2, losingContext2);

Expand Down

0 comments on commit d20902a

Please sign in to comment.