Ответ 1
Вы можете установить переменные, которые вам нужны, в качестве полей тестового класса, а затем инициализировать их в методе TestInitialize.
class Tests
{
// these are needed on every test
APIContext apicon;
XRepository xRep;
Controller controller;
RelevantFactoryModel update;
[TestInitialize]
public void TestInitialize()
{
apicon = new APIContext();
xRep = new xRepository(apicon);
controller = new relevantController(cRep);
controller.Request = new HttpRequestMessage();
controller.Configuration = new HttpConfiguration();
update = new relevantFactoryModel();
}
}
Таким образом, поля могут быть доступны из каждого теста