@@ -41,7 +41,6 @@ public async Task ServiceInterop_BadRequestContainsInnerException()
4141 It . IsAny < Cosmos . GeospatialType > ( ) ,
4242 It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TryCatch < PartitionedQueryExecutionInfo > . FromException ( innerException ) ) ;
4343
44- Mock < ITrace > trace = new Mock < ITrace > ( ) ;
4544 CosmosException cosmosException = await Assert . ThrowsExceptionAsync < CosmosException > ( ( ) => QueryPlanRetriever . GetQueryPlanWithServiceInteropAsync (
4645 queryClient . Object ,
4746 new SqlQuerySpec ( "selectttttt * from c" ) ,
@@ -50,8 +49,7 @@ public async Task ServiceInterop_BadRequestContainsInnerException()
5049 hasLogicalPartitionKey : false ,
5150 geospatialType : Cosmos . GeospatialType . Geography ,
5251 useSystemPrefix : false ,
53- trace . Object ,
54- default ) ) ;
52+ NoOpTrace . Singleton ) ) ;
5553
5654 Assert . AreEqual ( HttpStatusCode . BadRequest , cosmosException . StatusCode ) ;
5755 Assert . AreEqual ( innerException , cosmosException . InnerException ) ;
@@ -92,5 +90,40 @@ public async Task ServiceInterop_BadRequestContainsOriginalCosmosException()
9290
9391 Assert . AreEqual ( expectedException , cosmosException ) ;
9492 }
93+
94+ [ TestMethod ]
95+ public async Task ServiceInterop_E_UNEXPECTED ( )
96+ {
97+ UnexpectedQueryPartitionProviderException innerException = new UnexpectedQueryPartitionProviderException ( "E_UNEXPECTED" ) ;
98+ Mock < CosmosQueryClient > queryClient = new Mock < CosmosQueryClient > ( ) ;
99+
100+ queryClient . Setup ( c => c . TryGetPartitionedQueryExecutionInfoAsync (
101+ It . IsAny < SqlQuerySpec > ( ) ,
102+ It . IsAny < ResourceType > ( ) ,
103+ It . IsAny < Documents . PartitionKeyDefinition > ( ) ,
104+ It . IsAny < bool > ( ) ,
105+ It . IsAny < bool > ( ) ,
106+ It . IsAny < bool > ( ) ,
107+ It . IsAny < bool > ( ) ,
108+ It . IsAny < bool > ( ) ,
109+ It . IsAny < bool > ( ) ,
110+ It . IsAny < Cosmos . GeospatialType > ( ) ,
111+ It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TryCatch < PartitionedQueryExecutionInfo > . FromException ( innerException ) ) ;
112+
113+ CosmosException cosmosException = await Assert . ThrowsExceptionAsync < CosmosException > ( ( ) => QueryPlanRetriever . GetQueryPlanWithServiceInteropAsync (
114+ queryClient . Object ,
115+ new SqlQuerySpec ( "Super secret query that triggers bug" ) ,
116+ ResourceType . Document ,
117+ new Documents . PartitionKeyDefinition ( ) { Paths = new Collection < string > ( ) { "/id" } } ,
118+ hasLogicalPartitionKey : false ,
119+ geospatialType : Cosmos . GeospatialType . Geography ,
120+ useSystemPrefix : false ,
121+ NoOpTrace . Singleton ) ) ;
122+
123+ Assert . AreEqual ( HttpStatusCode . InternalServerError , cosmosException . StatusCode ) ;
124+ Assert . AreEqual ( innerException , cosmosException . InnerException ) ;
125+ Assert . IsNotNull ( cosmosException . Trace ) ;
126+ Assert . IsNotNull ( cosmosException . Diagnostics ) ;
127+ }
95128 }
96129}
0 commit comments