public async Task CanLoadAndSaveSagaData() { var initialSagaData = new BasicSagaData { Id = Guid.NewGuid(), IntegerField = 77, StringField = "Springfield" }; await _sagaStorage.Insert(initialSagaData, _correlationProperties); var match = await _sagaStorage.Find(typeof(BasicSagaData), nameof(BasicSagaData.StringField), "Springfield"); Assert.That(match, Is.Not.Null); Assert.That(match.Id, Is.EqualTo(initialSagaData.Id)); }
public async Task <ISagaData> Find(Type sagaDataType, string propertyName, object propertyValue) { return(await _sagaStorage.Find(sagaDataType, propertyName, propertyValue)); }
public async Task IncludesTypeAsFindCriteria_CorrelationById() { var knownId = Guid.NewGuid(); var correlationProperties = new[] { new TestCorrelationProperty(nameof(ISagaData.Id), typeof(Data1)) }; await _sagaStorage.Insert(new Data1 { Id = knownId }, correlationProperties); var resultLookingForData1 = await _sagaStorage.Find(typeof(Data1), nameof(ISagaData.Id), knownId); var resultLookingForData2 = await _sagaStorage.Find(typeof(Data2), nameof(ISagaData.Id), knownId); Assert.That(resultLookingForData1, Is.Not.Null); Assert.That(resultLookingForData2, Is.Null); }
public async Task GetsNullWhenNoInstanceMatches() { var data = await _sagaStorage.Find(typeof(TestSagaData), "CorrelationId", "whatever"); Assert.That(data, Is.Null); }