public async void NoClientIdentifierInHeaders() { // Given var context = new DefaultHttpContext(); var provider = new HeaderBasedClientIdentifierProvider(); // When header-based client identifier provider is executed var result = await provider.ExecuteAsync(context); // Then it should return null identifier result.Should().BeNull(); }
public async void ClientIdentifierSetUsingCustomHeader() { // Given const string HeaderName = "my-custom-header"; const string ClientId = "tester"; var provider = new HeaderBasedClientIdentifierProvider(HeaderName); var context = new DefaultHttpContext(); context.Request.Headers.Add(HeaderName, ClientId); // When header-based client identifier provider is executed var result = await provider.ExecuteAsync(context); // Then it should return the expected client identifier result.Should().Be(ClientId); }