Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3392,20 +3392,14 @@ public async Task VerifySessionNotFoundStatistics()

string invalidSessionToken = this.GetDifferentLSNToken(responseAstype.Headers.Session, 2000);

try
{
ItemResponse<ToDoActivity> readResponse = await container.ReadItemAsync<ToDoActivity>(temp.id, new Cosmos.PartitionKey(temp.pk), new ItemRequestOptions() { SessionToken = invalidSessionToken });
Assert.Fail("Should had thrown ReadSessionNotAvailable");
}
catch (CosmosException cosmosException)
{
Assert.AreEqual(StatusCodes.NotFound, cosmosException.StatusCode);
Assert.AreEqual(SubStatusCodes.ReadSessionNotAvailable, cosmosException.SubStatusCode);

Assert.IsTrue(cosmosException.Message.Contains("The read/write session is not available"), cosmosException.Message);
string exception = cosmosException.ToString();
Assert.IsTrue(exception.Contains("Point Operation Statistics"), exception);
}
// With exception-less behavior enabled by default, typed APIs return responses instead of throwing exceptions
ItemResponse<ToDoActivity> readResponse = await container.ReadItemAsync<ToDoActivity>(temp.id, new Cosmos.PartitionKey(temp.pk), new ItemRequestOptions() { SessionToken = invalidSessionToken });

Assert.AreEqual(HttpStatusCode.NotFound, readResponse.StatusCode);
Assert.AreEqual(SubStatusCodes.ReadSessionNotAvailable, readResponse.Headers.SubStatusCode);

string diagnostics = readResponse.Diagnostics.ToString();
Assert.IsTrue(diagnostics.Contains("Point Operation Statistics"), diagnostics);
}
finally
{
Expand Down