コード例 #1
0
ファイル: DynamicTest.cs プロジェクト: Zero-GHub/hyde
        public async Task GetRange_RetrievingObjectViaDynamic_ShouldHydrateEntitiesWithAllProperties()
        {
            foreach (int i in Enumerable.Range(0, 10))
            {
                var simpleEntity = new DecoratedItem
                {
                    Id   = string.Format("Dynamic_{0}", i),
                    Name = "Test",
                    Age  = 1
                };

                _tableStorageProvider.Add(_tableName, simpleEntity);
                await _tableStorageProvider.SaveAsync();
            }

            var result = await _tableStorageProvider.CreateQuery(_tableName).PartitionKeyFrom("Dynamic_2").Inclusive().PartitionKeyTo("Dynamic_6").Inclusive().Async();

            Assert.AreEqual(5, result.Count());
            Assert.AreEqual(1, (int)result.First().Age);
        }
コード例 #2
0
        public async Task GetCollection_ObjectInsertedWithClassAndRetrievedViaDynamic_ShouldReturnFullyHydratedObjects()
        {
            string partitionKey = "Test";

            foreach (var i in Enumerable.Range(0, 10))
            {
                var simpleEntity = new DecoratedItem
                {
                    Id   = partitionKey,
                    Name = string.Format("Dynamic{0}_{1}", DateTime.Now.Ticks, i),
                    Age  = 1
                };

                _tableStorageProvider.Add(_tableName, simpleEntity);

                await _tableStorageProvider.SaveAsync();
            }

            var result = await _tableStorageProvider.CreateQuery(_tableName).PartitionKeyEquals(partitionKey).Async();

            Assert.AreEqual(10, result.Count());
            Assert.AreEqual(1, result.First().Age);
        }