I'm trying to get a path url from the following notificatorConfig.json file:
{
"UserNotificatorConfig": {
"URL": "http://localhost:8001",
"BasePath": "/send-message/android"
}
}
Using a ConfigurationBuilder() as follows:
public async Task Send(string message)
{
var config = new ConfigurationBuilder()
.AddJsonFile("notificatorConfig.json", true)
.Build();
var url = config.GetSection("UserNotificatorConfig:URL").Value;
var basePath = config.GetSection("UserNotificatorConfig:BasePath").Value;
await _rest.PostAsync<Notification>(url, basePath, message);
}
Both my json file and the file where my Send() method is located, are in the same folder.
But every time I try to debug this method on unit tests I get null values for both parameters url and basePath.
What am I missing here?