#c# #.net #app-config #vs-unit-testing-framework
#c# #.net #app-config #vs-unit-testing-framework
Вопрос:
У меня есть app.config со следующим разделом,
<configSections>
<section name="Identity"
type="MyProject.Test.Configuration.IdentitySection, MyProject" />
</configSections>
<Identity>
<Services>
<IdentityToken endpoint="example.com/api/token" timeout="60"/>
<Service endpoint="localhost/EmployeeService.svc" />
</Services>
<Proxy proxyurl="example2.com" proxyuser="user1readonly"
proxypassword="xxxxx" clientId="xxxxxxxxxxxxxxxxxx"
clientSecret="xxxx"/>
</Identity>
Затем после ConfigurationManager.GetSection(«Идентификатор»), как показано ниже,
IdentityConfigModel identitySection =
ConfigurationManager.GetSection("Identity") as IdentityConfigModel ;
получение следующих значений объекта,
identitySection.Услуги.IdentityToken.Раздел конечных точек и идентификаторов.Услуги.Обслуживание.Конечная точка как нулевая
Я вижу ключи в возвращаемом объекте, но соответствующие значения показывают null. Проблем с учетом регистра нет, поскольку я вижу имена в объекте, но значения равны нулю
Я делаю что-то не так в Appconfig? или я неправильно выполняю часть GetSection?