Esempio n. 1
0
        public async void When_provisioning_along_with_custom_properties()
        {
            var properties = new Dictionary<string, EntityProperty>
            {
                {"Created", new EntityProperty(DateTimeOffset.Now)},
                {"Active",  new EntityProperty(true)}
            };

            var stream = await Stream.ProvisionAsync(partition, StreamProperties.From(properties));
            var entity = partition.RetrieveStreamEntity();

            var expectedStream = new Stream
            (
                partition,
                entity.ETag, 0, 
                StreamProperties.From(properties)
            );

            stream.ShouldEqual(expectedStream.ToExpectedObject());

            var expectedEntity = new
            {
                RowKey = Api.StreamRowKey,
                Properties = StreamProperties.From(properties),
                Version = 0
            };

            entity.ShouldMatch(expectedEntity.ToExpectedObject());
        }
Esempio n. 2
0
        public async void When_partition_is_virgin()
        {
            var stream = await Stream.ProvisionAsync(partition);
            var entity = partition.RetrieveStreamEntity();
            
            var expectedStream = new Stream(partition, entity.ETag, 0, StreamProperties.None);
            stream.ShouldEqual(expectedStream.ToExpectedObject());

            var expectedEntity = new
            {
                RowKey = Api.StreamRowKey,
                Version = 0
            };

            entity.ShouldMatch(expectedEntity.ToExpectedObject());
        }