public async Task RevisionIsIncrementedOnPassedInInstanceWhenDeleting() { var sagaId = Guid.NewGuid(); var instance = new TestSagaData { Id = sagaId, Data = "yes, den kender jeg" }; var initialRevision = instance.Revision; await _sagaStorage.Insert(instance, _noCorrelationProperties); var revisionAfterInsert = instance.Revision; await _sagaStorage.Update(instance, _noCorrelationProperties); var revisionAfterUpdate = instance.Revision; await _sagaStorage.Delete(instance); var revisionAfterDelete = instance.Revision; Assert.That(initialRevision, Is.EqualTo(0), "Expected initial revisio (before any saga persister actions) to be 0"); Assert.That(revisionAfterInsert, Is.EqualTo(0), "Expected revision after first INSERT to be 0 because this is the first revision"); Assert.That(revisionAfterUpdate, Is.EqualTo(1), "Expected revision after UPDATE to be 1 because is has now been saved as REV 1"); Assert.That(revisionAfterDelete, Is.EqualTo(2), "Expceted revision after DELETE to be 2 because it's the best bet revision number to use even though it has most likely been deleted for good from the underlying storage"); }
public async Task Delete(ISagaData sagaData) { await _innerSagaStorage.Delete(sagaData); ISagaData _; _persistentSagaData.TryRemove(sagaData.Id, out _); }
public async Task CanDeleteSagaData() { var sagaId = Guid.NewGuid(); await _sagaStorage.Insert(new TestSagaData { Id = sagaId, Data = "yes, den kender jeg" }, _noCorrelationProperties); var loadedSagaData = await _sagaStorage.Find(typeof(TestSagaData), "Id", sagaId); Assert.That(loadedSagaData, Is.Not.Null); await _sagaStorage.Delete(loadedSagaData); var loadedSagaDataAfterDelete = await _sagaStorage.Find(typeof(TestSagaData), "Id", sagaId); Assert.That(loadedSagaDataAfterDelete, Is.Null); }
public async Task Delete(ISagaData sagaData) { await Task.Delay(_delayMilliseconds); await _sagaStorage.Delete(sagaData); }