I am trying to setup XUnit to test my google ad manager api service. When I run the test, I hit this exception.
Google.Api.Ads.AdManager.Lib.AdManagerApiException: 'AdManagerApiException: A valid application name was not found in the request header. Please provide a valid application name by modifying the ApplicationName setting in your application's
This is my constructor which has the issue to configure ApplicationName
I can't find NetworkCode and AuthorizationMethod
public class GoogleAdManagerServiceTest
{
private readonly GoogleAdManagerService _googleAdManagerService;
private readonly AdManagerUser _user;
public GoogleAdManagerServiceTest()
{
_user = new AdManagerUser();
_user.Config.ApplicationName = "xxx"; // How to configure ApplicationName because it cannot be found.
_user.Config.OAuth2ClientId = "xxx";
_user.Config.OAuth2ClientSecret = "xxx";
_user.Config.OAuth2RefreshToken = "xxx";
_googleAdManagerService = new GoogleAdManagerService(_user);
}
[Fact]
public void TestGetCompanies()
{
try
{
// Arrange
// Act
// Assert
}
catch (Exception ex)
{
Assert.True(false, $"Test failed with exception: {ex.Message}");
}
}
}