public async void ReturnsListKeyValuePair()
        {
            var mock = GetTableQuerySegments();

            TableMock.Setup(tt => tt.ExistsAsync()).ReturnsAsync(true);

            TableMock.Setup(tt => tt.ExecuteQuerySegmentedAsync(It.IsAny <TableQuery>(), It.IsAny <TableContinuationToken>()))
            .ReturnsAsync(mock);
            var fac = new AzureStorageFactory(AccountMock.Object)
            {
                CollectionName = "RiversUnitedStates"
            };
            var query = new TableQuery()
                        .Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "search"));
            var stuff = await fac.GetAsync <List <KeyValuePair <string, string> > >(query);

            Assert.IsType <List <KeyValuePair <string, string> > > (stuff);
        }
Beispiel #2
0
        public async Task PostBatchOperationWithDynamicEntities_NoPartitionKey(int listCount)
        {
            var list = BuildRiverTableEntities(listCount, "TACOS", false);
            var x    = new TableResult();

            x.Result         = list;
            x.HttpStatusCode = 200;

            TableMock.Setup(tt => tt.ExecuteBatchAsync(It.IsAny <TableBatchOperation>()))
            .ReturnsAsync(
                new List <TableResult>
            {
                x
            });
            var val = await Fac.PostBatchAsync(list);

            Assert.Equal(listCount, val);
        }
        public async Task DeleteBatchOperation(int listCount)
        {
            var list = BuildRiverEnumerable(listCount);
            var x    = new TableResult();

            x.Result         = list;
            x.HttpStatusCode = 200;

            TableMock.Setup(tt => tt.ExecuteBatchAsync(It.IsAny <TableBatchOperation>()))
            .ReturnsAsync(
                new List <TableResult>
            {
                x
            });
            var val = await Fac.DeleteBatchAsync(list);

            Assert.Equal(listCount, val);
        }