public void Serialization_WithoutCompression_DeserializesCorrectly() { var data = new DummyData(); var entity = new DummyJsonTableEntity(data, false); entity.DeserializeData().Should().BeEquivalentTo(data); }
public void Serialization_PropertyIsDateTimeOffset_KeepsOffsetValue() { var data = new DummyData { DateTimeOffset = DateTimeOffset.Now }; // Initialize value with non-UTC. var entity = new DummyJsonTableEntity(data); entity.DeserializeData().Should().BeEquivalentTo(data); }
public void Serialization_PropertyIsImmutable_UpdatesValue() { var data = new DummyData { SnapshotId = new SnapshotId { EntryId = Unified.NewCode(), EntryVersion = 1 } }; var entity = new DummyJsonTableEntity(data); entity.DeserializeData().Should().BeEquivalentTo(data); }
public void Serialization_PropertyIsMissing_LeavesExistingValue() { var dataWithoutProperty = new DummyDataWithoutSnapshotId { DateTimeOffset = DateTimeOffset.UtcNow.AddDays(1) }; var expected = new DummyData { DateTimeOffset = dataWithoutProperty.DateTimeOffset }; // Create JSON without property. var entityWithoutProperty = new DummyWithoutSnapshotIdJsonTableEntity(dataWithoutProperty); // Set JSON to entity with property. var entity = new DummyJsonTableEntity { IsCompressed = entityWithoutProperty.IsCompressed, Data = entityWithoutProperty.Data }; entity.DeserializeData().Should().BeEquivalentTo(expected); }