Skip to content

Commit

Permalink
Adding more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ealsur committed Jan 4, 2022
1 parent ec8f4ce commit 85049c4
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -414,14 +414,18 @@ await GatewayStoreModel.ApplySessionTokenAsync(
});
}

[TestMethod]
public async Task TestRequestOverloadRemovesSessionToken()
[DataTestMethod]
[DataRow(false, false, DisplayName = "Single master - Read")]
[DataRow(true, false, DisplayName = "Multi master - Read")]
[DataRow(false, true, DisplayName = "Single master - Write")]
[DataRow(true, true, DisplayName = "Multi master - Write")]
public async Task TestRequestOverloadRemovesSessionToken(bool multiMaster, bool isWriteRequest)
{
INameValueCollection headers = new StoreRequestNameValueCollection();
headers.Set(HttpConstants.HttpHeaders.ConsistencyLevel, ConsistencyLevel.Eventual.ToString());

DocumentServiceRequest dsrNoSessionToken = DocumentServiceRequest.CreateFromName(
OperationType.Read,
isWriteRequest ? OperationType.Create : OperationType.Read,
"Test",
ResourceType.Document,
AuthorizationTokenType.PrimaryMasterKey,
Expand All @@ -432,6 +436,7 @@ public async Task TestRequestOverloadRemovesSessionToken()
sMock.Setup(x => x.ResolveGlobalSessionToken(dsrNoSessionToken)).Returns(dsrSessionToken);

Mock<IGlobalEndpointManager> globalEndpointManager = new Mock<IGlobalEndpointManager>();
globalEndpointManager.Setup(gem => gem.CanUseMultipleWriteLocations(It.Is<DocumentServiceRequest>(drs => drs == dsrNoSessionToken))).Returns(multiMaster);
await this.GetGatewayStoreModelForConsistencyTest(async (gatewayStoreModel) =>
{
await GatewayStoreModel.ApplySessionTokenAsync(
Expand Down

0 comments on commit 85049c4

Please sign in to comment.