Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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()));
        }
Ejemplo n.º 3
0
        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));
        }