private void UpdateNotifyIconText() { var builder = new StringBuilder(); string environmentName = _fileUpdater.GetExistingTargetFileEnvironment(_appSetting.HostFilePath); if (!string.IsNullOrEmpty(environmentName)) { builder.AppendLine($"Host file pointed to: {environmentName}"); } else { builder.AppendLine("Host file pointed to: None"); } var currentDNS = _dnsManager.GetDNS(); if (currentDNS != null) { var sourceUsed = _appSetting.Sources.FirstOrDefault(s => s.FirstDNS == currentDNS.FirstAddress && s.SecondDNS == currentDNS.SecondAddress); if (sourceUsed != null) { builder.AppendLine($"DNS pointed to: {sourceUsed.Name}"); } else { builder.AppendLine($"DNS pointed to: Unknown"); } } else { builder.AppendLine("DNS pointed to: None"); } _notifyIcon.Text = builder.ToString(); _notifyIcon.ShowBalloonTip(0, "Status", builder.ToString(), ToolTipIcon.Info); #if DEBUG Debug.WriteLine(_notifyIcon.Text); _notifyIcon.Text += "(DEBUG)"; #endif }
public void FileUpdaterUnitTests_GetEnvironment_Exists() { string environment = _fileUpdater.GetExistingTargetFileEnvironment(DirtyHostFilePath); Assert.AreEqual(EnvironmentName, environment); }