Exemplo n.º 1
0
        public void GetAllEntitiesInPartition_Ok()
        {
            //Arrange
            var tableEntity = new DynamicTableEntity();

            var tableQuerySegmentMock = new Mock <TableQuerySegment <DynamicTableEntity> >(new List <DynamicTableEntity> {
                tableEntity
            });

            //tableQuerySegmentMock.Setup(s => s.Results).Returns(new List<DynamicTableEntity> {tableEntity});

            var(cloudTableMock, pool) =
                CreateTablePoolWithMockForExecuteQuery(tableEntity, SetupExecuteQuery);
            cloudTableMock.Setup(t => t.ExecuteQuerySegmentedAsync(It.IsAny <TableQuery <DynamicTableEntity> >(),
                                                                   It.IsAny <TableContinuationToken>(),
                                                                   It.IsAny <TableRequestOptions>(),
                                                                   It.IsAny <OperationContext>(),
                                                                   It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(tableQuerySegmentMock.Object));

            //Act & Assert
            cloudTableMock.Verify();
            TableStorageHelpers.GetAllEntitiesInPartition <DynamicTableEntity>(pool, "partitionKey")
            .Should()
            .Contain(tableEntity);
        }