Skip to content
Merged
Show file tree
Hide file tree
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 @@ -586,6 +586,11 @@ public virtual SessionTokenManagementMode SessionTokenManagementMode
/// </summary>
public virtual CosmosOptionsExtension WithSessionTokenManagementMode(SessionTokenManagementMode mode)
{
if (!Enum.IsDefined(mode))
{
throw new ArgumentOutOfRangeException(nameof(mode));
}

var clone = Clone();

clone._sessionTokenManagementMode = mode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ public async Task Connection_string_overrides_endpoint_and_token()
public void Throws_for_invalid_values()
=> Throws<ArgumentOutOfRangeException>(o => o.ConnectionMode((ConnectionMode)958410610));

[Fact]
public void Throws_for_invalid_session_token_management_mode()
=> Throws<ArgumentOutOfRangeException>(o => o.SessionTokenManagementMode((SessionTokenManagementMode)42));

private void Test(
Action<CosmosDbContextOptionsBuilder> cosmosOptionsAction,
Action<CosmosOptionsExtension> extensionAssert)
Expand Down
Loading