public void Should_WriteLocalDateEntity() { var date = DateTime.Today; var entity = new LocalDateEntity() { LocalDate = LocalDate.FromDateTime(date) }; var tEntity = (ITableEntity)entity; var result = tEntity.WriteEntity(new OperationContext()); result.Should().ContainKey(nameof(LocalDateEntity.LocalDate)); result[nameof(LocalDateEntity.LocalDate)].DateTimeOffsetValue.Should().NotBeNull(); result[nameof(LocalDateEntity.LocalDate)].DateTimeOffsetValue.Should().Be(date); }
public void Should_ReadLocalDateEntity_FromDateTimeOffset() { var date = DateTime.Now; var entity = new LocalDateEntity(); var tEntity = (ITableEntity)entity; tEntity.ReadEntity(new Dictionary <string, EntityProperty> { { nameof(LocalDateEntity.LocalDate), EntityProperty.GeneratePropertyForDateTimeOffset(date) } }, new OperationContext()); entity.LocalDate.Should().BeLessOrEqualTo(LocalDate.FromDateTime(date.ToUniversalTime())); }
public void Should_ReadLocalDateEntity() { var date = DateTime.Now; var entity = new LocalDateEntity(); var tEntity = (ITableEntity)entity; tEntity.ReadEntity(new Dictionary <string, EntityProperty> { { nameof(LocalDateEntity.LocalDate), EntityProperty.GeneratePropertyForString(LocalDatePattern.Iso.Format(LocalDate.FromDateTime(date))) } }, new OperationContext()); entity.LocalDate.Should().BeLessOrEqualTo(LocalDate.FromDateTime(date)); }