public void SetAuthenticationTokenThrowsIfUseAzureManagedIdentityIsTrueAndTokenInvalid() { // Arrange var sut = new AzureManagedServiceAuthenticator(true, "TestAccessToken"); // Act + assert using (var sqlConnection = new SqlConnection(DatabaseFixture.LogEventsConnectionString)) { Assert.Throws <AzureServiceTokenProviderException>(() => sut.SetAuthenticationToken(sqlConnection)); } }
public void SetAuthenticationTokenDoesNotSetTokenIfUseAzureManagedIdentityIsFalse() { // Arrange var sut = new AzureManagedServiceAuthenticator(false, null); // Act using (var sqlConnection = new SqlConnection(DatabaseFixture.LogEventsConnectionString)) { sut.SetAuthenticationToken(sqlConnection); // Assert Assert.Null(sqlConnection.AccessToken); } }