File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
test/Serilog.Settings.AppSettings.Tests Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 11using System ;
22using System . Configuration ;
3+ using System . IO ;
34using Xunit ;
45using Serilog . Events ;
56using Serilog . Tests . Support ;
@@ -11,8 +12,12 @@ public class AppSettingsTests
1112 {
1213 static AppSettingsTests ( )
1314 {
14- AppDomain . CurrentDomain . SetData ( "APP_CONFIG_FILE" ,
15- System . IO . Path . Combine ( System . IO . Directory . GetCurrentDirectory ( ) , @"..\..\..\..\app.config" ) ) ;
15+ var basePath = AppDomain . CurrentDomain . BaseDirectory ;
16+ var config = Path . GetFullPath ( Path . Combine ( basePath , "app.config" ) ) ;
17+ if ( ! File . Exists ( config ) )
18+ throw new InvalidOperationException ( $ "Can't find app.config in { basePath } ") ;
19+
20+ AppDomain . CurrentDomain . SetData ( "APP_CONFIG_FILE" , config ) ;
1621 }
1722
1823 [ Fact ]
Original file line number Diff line number Diff line change 77 },
88 "buildOptions" : {
99 "keyFile" : " ../../assets/Serilog.snk" ,
10- "preserveCompilationContext" : true
10+ "preserveCompilationContext" : true ,
11+ "copyToOutput" : [ " app.config" ]
1112 },
1213 "frameworks" : {
1314 "net4.5.2" : {
1617 },
1718 "dependencies" : {
1819 "Newtonsoft.Json" : " 7.0.1" ,
19- "Rx-Main" : " 2.2.5" ,
20- "xunit.runner.visualstudio" : " 2.1.0" ,
2120 "Serilog.Sinks.TextWriter" : " 2.0.0" ,
2221 "Serilog.Sinks.RollingFile" : " 2.0.0" ,
2322 "Serilog.Sinks.PeriodicBatching" : " 2.0.0" ,
You can’t perform that action at this time.
0 commit comments