@@ -41,7 +41,6 @@ public async Task ServiceInterop_BadRequestContainsInnerException()
41
41
It . IsAny < Cosmos . GeospatialType > ( ) ,
42
42
It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TryCatch < PartitionedQueryExecutionInfo > . FromException ( innerException ) ) ;
43
43
44
- Mock < ITrace > trace = new Mock < ITrace > ( ) ;
45
44
CosmosException cosmosException = await Assert . ThrowsExceptionAsync < CosmosException > ( ( ) => QueryPlanRetriever . GetQueryPlanWithServiceInteropAsync (
46
45
queryClient . Object ,
47
46
new SqlQuerySpec ( "selectttttt * from c" ) ,
@@ -50,8 +49,7 @@ public async Task ServiceInterop_BadRequestContainsInnerException()
50
49
hasLogicalPartitionKey : false ,
51
50
geospatialType : Cosmos . GeospatialType . Geography ,
52
51
useSystemPrefix : false ,
53
- trace . Object ,
54
- default ) ) ;
52
+ NoOpTrace . Singleton ) ) ;
55
53
56
54
Assert . AreEqual ( HttpStatusCode . BadRequest , cosmosException . StatusCode ) ;
57
55
Assert . AreEqual ( innerException , cosmosException . InnerException ) ;
@@ -92,5 +90,40 @@ public async Task ServiceInterop_BadRequestContainsOriginalCosmosException()
92
90
93
91
Assert . AreEqual ( expectedException , cosmosException ) ;
94
92
}
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
+ }
95
128
}
96
129
}
0 commit comments