private AppConfiguration InitializeConfiguration() { string configFilePath = AppDomain.CurrentDomain.BaseDirectory + "\\config.json"; var config = new AppConfiguration(); config.SetConfiguration(configFilePath); timerInterval = config.Interval; return config; }
public void SetConfiguration(string configFilePath) { var configData = System.IO.File.ReadAllText(configFilePath); configData = configData.Replace(@"\", @"\\"); var config = new AppConfiguration(); config = JsonConvert.DeserializeObject<AppConfiguration>(configData); Interval = config.Interval; T24SqlServer = config.T24SqlServer; T24User = config.T24User; T24Password = config.T24Password; FtpServerRTGS = config.FtpServerRTGS; FtpUser = config.FtpUser; FtpPassword = config.FtpPassword; }
public void ConfigurationTestValidData() { string configFilePath = AppDomain.CurrentDomain.BaseDirectory + "\\config.json"; var config = new AppConfiguration(); config.SetConfiguration(configFilePath); var expected = new AppConfiguration() { Interval = 10, T24SqlServer = "172.16.11.11", FtpServerRTGS = @"ftp://10.1.10.24/" }; var actual = config; Assert.AreEqual(expected.Interval, actual.Interval); Assert.AreEqual(expected.T24SqlServer, actual.T24SqlServer); Assert.AreEqual(expected.FtpServerRTGS, actual.FtpServerRTGS); }
public TransactionController(AppConfiguration _config, ConsoleLogLibrary _log) { config = _config; log = _log; }