public async Task NizzleName() { var id = Guid.NewGuid(); var guidCorrelationValue = Guid.NewGuid(); var stringCorrelationValue = "hej"; var dateTimeCorrelationValue = new DateTime(1979, 3, 19); var dateTimeOffsetCorrelationValue = new DateTimeOffset(1979, 3, 19, 20, 0, 0, TimeSpan.FromHours(2)); var decimalCorrelationValue = 23M; var intCorrelationValue = 8; var data = new SagaDataWithVariousCorrelationProperties { Id = id, CorrelateByString = stringCorrelationValue, CorrelateByDateTime = dateTimeCorrelationValue, CorrelateByDateTimeOffset = dateTimeOffsetCorrelationValue, CorrelateByDecimal = decimalCorrelationValue, CorrelateByGuid = guidCorrelationValue, CorrelateByInt = intCorrelationValue }; var correlationProperties = new[] { GetCorrelationProperty(d => d.CorrelateByString), GetCorrelationProperty(d => d.CorrelateByInt), //GetCorrelationProperty(d => d.CorrelateByDecimal), //GetCorrelationProperty(d => d.CorrelateByDateTime), //GetCorrelationProperty(d => d.CorrelateByDateTimeOffset), GetCorrelationProperty(d => d.CorrelateByGuid), }; await _sagaStorage.Insert(data, correlationProperties); var dataByString = await Find(stringCorrelationValue, d => d.CorrelateByString); var dataByInt = await Find(intCorrelationValue, d => d.CorrelateByInt); var dataByGuid = await Find(guidCorrelationValue, d => d.CorrelateByGuid); Assert.That(dataByString.Id, Is.EqualTo(id)); Assert.That(dataByInt.Id, Is.EqualTo(id)); Assert.That(dataByGuid.Id, Is.EqualTo(id)); }
public async Task CorrelateByDifferentPropertyTypes() { var id = Guid.NewGuid(); var guidCorrelationValue = Guid.NewGuid(); var stringCorrelationValue = "hej"; var dateTimeCorrelationValue = new DateTime(1979, 3, 19); var dateTimeOffsetCorrelationValue = new DateTimeOffset(1979, 3, 19, 20, 0, 0, TimeSpan.FromHours(2)); var decimalCorrelationValue = 23M; var intCorrelationValue = 8; var boolCorrelationValue = true; var byteCorrelationValue = (byte)64; var shortCorrelationValue = (short)78; var longCorrelationValue = 2323232L; var data = new SagaDataWithVariousCorrelationProperties { Id = id, CorrelateByString = stringCorrelationValue, CorrelateByDateTime = dateTimeCorrelationValue, CorrelateByDateTimeOffset = dateTimeOffsetCorrelationValue, CorrelateByDecimal = decimalCorrelationValue, CorrelateByGuid = guidCorrelationValue, CorrelateByInt = intCorrelationValue, CorrelateByBool = boolCorrelationValue, CorrelateByByte = byteCorrelationValue, CorrelateByShort = shortCorrelationValue, CorrelateByLong = longCorrelationValue, }; var correlationProperties = new[] { GetCorrelationProperty(d => d.CorrelateByString), GetCorrelationProperty(d => d.CorrelateByBool), GetCorrelationProperty(d => d.CorrelateByShort), GetCorrelationProperty(d => d.CorrelateByInt), GetCorrelationProperty(d => d.CorrelateByLong), GetCorrelationProperty(d => d.CorrelateByByte), //GetCorrelationProperty(d => d.CorrelateByDecimal), //GetCorrelationProperty(d => d.CorrelateByDateTime), //GetCorrelationProperty(d => d.CorrelateByDateTimeOffset), GetCorrelationProperty(d => d.CorrelateByGuid), }; await _sagaStorage.Insert(data, correlationProperties); var dataByString = await Find(stringCorrelationValue, d => d.CorrelateByString); var dataByInt = await Find(intCorrelationValue, d => d.CorrelateByInt); var dataByGuid = await Find(guidCorrelationValue, d => d.CorrelateByGuid); var dataByBool = await Find(boolCorrelationValue, d => d.CorrelateByBool); var dataByByte = await Find(byteCorrelationValue, d => d.CorrelateByByte); var dataByShort = await Find(shortCorrelationValue, d => d.CorrelateByShort); var dataByLong = await Find(longCorrelationValue, d => d.CorrelateByLong); Assert.That(dataByString.Id, Is.EqualTo(id)); Assert.That(dataByInt.Id, Is.EqualTo(id)); Assert.That(dataByGuid.Id, Is.EqualTo(id)); Assert.That(dataByBool.Id, Is.EqualTo(id)); Assert.That(dataByShort.Id, Is.EqualTo(id)); Assert.That(dataByLong.Id, Is.EqualTo(id)); Assert.That(dataByByte.Id, Is.EqualTo(id)); }