August 2017
Intermediate to advanced
330 pages
7h 26m
English
Let's try and replicate our API test. Create a new .Net Core project named PuhoiAPI.xUnit.Tests, and change the project.json file as follows.
Add an appsettings.json file with the following entry:
{
"baseUri": "http://localhost:5000/api/"
}
Add a class named StoresControllerShould as done previously. Copy RedStoreModel and GreenStoreModel as previously set out.
This the constructor:
public StoresControllerShould()
{
var builder = new ConfigurationBuilder().AddJsonFile("appsettings.json");
var config = builder.Build();
_baseUri = config[_configurationBaseUri];
_jsonSerializer = new JsonSerializer();
}
We use the ConfigurationBuilder class to read our appsettings file, which is in a JSON format.
This is different from what we have ...
Read now
Unlock full access