public void WhenIgnoringNullProperties_DoesNotSaveNullPropertiesOnUpdate() { var persister = CreatePersister(createTables: true); persister.DoNotIndexNullProperties(); const string correlationProperty1 = "correlation property 1"; const string correlationProperty2 = "correlation property 2"; var correlationPropertyPaths = new[] { Reflect.Path <PieceOfSagaData>(s => s.SomeProperty), Reflect.Path <PieceOfSagaData>(s => s.AnotherProperty) }; var firstPieceOfSagaDataWithNullValueOnProperty = new PieceOfSagaData { SomeProperty = correlationProperty1, AnotherProperty = "random12423" }; var nextPieceOfSagaDataWithNullValueOnProperty = new PieceOfSagaData { SomeProperty = correlationProperty2, AnotherProperty = "random38791387" }; persister.Insert(firstPieceOfSagaDataWithNullValueOnProperty, correlationPropertyPaths); persister.Insert(nextPieceOfSagaDataWithNullValueOnProperty, correlationPropertyPaths); var firstPiece = persister.Find <PieceOfSagaData>(Reflect.Path <PieceOfSagaData>(s => s.SomeProperty), correlationProperty1); firstPiece.AnotherProperty = null; persister.Update(firstPiece, correlationPropertyPaths); var nextPiece = persister.Find <PieceOfSagaData>(Reflect.Path <PieceOfSagaData>(s => s.SomeProperty), correlationProperty2); nextPiece.AnotherProperty = null; persister.Update(nextPiece, correlationPropertyPaths); }
public void WhenIgnoringNullProperties_DoesNotSaveNullPropertiesOnUpdate() { persister.EnsureTablesAreCreated() .DoNotIndexNullProperties(); const string correlationProperty1 = "correlation property 1"; const string correlationProperty2 = "correlation property 2"; var correlationPropertyPaths = new[] { Reflect.Path<PieceOfSagaData>(s => s.SomeProperty), Reflect.Path<PieceOfSagaData>(s => s.AnotherProperty) }; var firstPieceOfSagaDataWithNullValueOnProperty = new PieceOfSagaData { SomeProperty = correlationProperty1, AnotherProperty="random12423" }; var nextPieceOfSagaDataWithNullValueOnProperty = new PieceOfSagaData { SomeProperty = correlationProperty2, AnotherProperty="random38791387" }; persister.Insert(firstPieceOfSagaDataWithNullValueOnProperty, correlationPropertyPaths); persister.Insert(nextPieceOfSagaDataWithNullValueOnProperty, correlationPropertyPaths); var firstPiece = persister.Find<PieceOfSagaData>(Reflect.Path<PieceOfSagaData>(s => s.SomeProperty), correlationProperty1); firstPiece.AnotherProperty = null; persister.Update(firstPiece, correlationPropertyPaths); var nextPiece = persister.Find<PieceOfSagaData>(Reflect.Path<PieceOfSagaData>(s => s.SomeProperty), correlationProperty2); nextPiece.AnotherProperty = null; persister.Update(nextPiece, correlationPropertyPaths); }
public void WhenIgnoringNullProperties_DoesNotSaveNullPropertiesOnInsert() { var persister = CreatePersister(createTables: true); persister.DoNotIndexNullProperties(); const string correlationProperty1 = "correlation property 1"; const string correlationProperty2 = "correlation property 2"; var correlationPropertyPaths = new[] { Reflect.Path <PieceOfSagaData>(s => s.SomeProperty), Reflect.Path <PieceOfSagaData>(s => s.AnotherProperty) }; var firstPieceOfSagaDataWithNullValueOnProperty = new PieceOfSagaData { SomeProperty = correlationProperty1 }; var nextPieceOfSagaDataWithNullValueOnProperty = new PieceOfSagaData { SomeProperty = correlationProperty2 }; var firstId = firstPieceOfSagaDataWithNullValueOnProperty.Id; var nextId = nextPieceOfSagaDataWithNullValueOnProperty.Id; persister.Insert(firstPieceOfSagaDataWithNullValueOnProperty, correlationPropertyPaths); // must not throw: persister.Insert(nextPieceOfSagaDataWithNullValueOnProperty, correlationPropertyPaths); var firstPiece = persister.Find <PieceOfSagaData>(Reflect.Path <PieceOfSagaData>(s => s.SomeProperty), correlationProperty1); var nextPiece = persister.Find <PieceOfSagaData>(Reflect.Path <PieceOfSagaData>(s => s.SomeProperty), correlationProperty2); Assert.That(firstPiece.Id, Is.EqualTo(firstId)); Assert.That(nextPiece.Id, Is.EqualTo(nextId)); }
public void WhenIgnoringNullProperties_DoesNotSaveNullPropertiesOnInsert() { persister.EnsureTablesAreCreated() .DoNotIndexNullProperties(); const string correlationProperty1 = "correlation property 1"; const string correlationProperty2 = "correlation property 2"; var correlationPropertyPaths = new[] { Reflect.Path<PieceOfSagaData>(s => s.SomeProperty), Reflect.Path<PieceOfSagaData>(s => s.AnotherProperty) }; var firstPieceOfSagaDataWithNullValueOnProperty = new PieceOfSagaData { SomeProperty = correlationProperty1 }; var nextPieceOfSagaDataWithNullValueOnProperty = new PieceOfSagaData { SomeProperty = correlationProperty2 }; var firstId = firstPieceOfSagaDataWithNullValueOnProperty.Id; var nextId = nextPieceOfSagaDataWithNullValueOnProperty.Id; persister.Insert(firstPieceOfSagaDataWithNullValueOnProperty, correlationPropertyPaths); // must not throw: persister.Insert(nextPieceOfSagaDataWithNullValueOnProperty, correlationPropertyPaths); var firstPiece = persister.Find<PieceOfSagaData>(Reflect.Path<PieceOfSagaData>(s => s.SomeProperty), correlationProperty1); var nextPiece = persister.Find<PieceOfSagaData>(Reflect.Path<PieceOfSagaData>(s => s.SomeProperty), correlationProperty2); Assert.That(firstPiece.Id, Is.EqualTo(firstId)); Assert.That(nextPiece.Id, Is.EqualTo(nextId)); }