public void AcceptanceTest_NotToBeRunAutomatically() { //---------------Set up test pack------------------- var trayIcon = new TrayIcon(Resource1.Happy_smiley_face); trayIcon.DefaultBalloonTipTimeout = 5000; trayIcon.DefaultTipText = "Default tip text"; trayIcon.DefaultTipTitle = "Default tip title"; trayIcon.DefaultBalloonTipClickedAction = () => MessageBox.Show("You clicked the default balloon tip"); trayIcon.AddMenuItem("MessageBox", () => MessageBox.Show("Hello")); trayIcon.AddMenuSeparator(); trayIcon.AddMenuItem("Balloon tip", () => { trayIcon.ShowBalloonTipFor(5000, "Current time", "The current time is: " + DateTime.Now.ToString("HH:mm:ss"), ToolTipIcon.Info, () => MessageBox.Show("You clicked the balloon!"), () => MessageBox.Show("You closed the balloon ):")); }); trayIcon.AddMenuItem("Exit", () => { trayIcon.Hide(); Application.Exit(); }); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- trayIcon.Show(); //---------------Test Result ----------------------- Application.Run(); }
private void MainForm_Load(object sender, EventArgs e) { Hide(); Icon ico = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location); TrayIcon trayIcon = new TrayIcon(ico); trayIcon.Show(); machines = wrapper.ListMachines() as List<Machine>; client.BeginReceive(new AsyncCallback(RequestCallback), null); }
public void ShouldExposeInternalNotificationIcon() { //---------------Set up test pack------------------- //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var icon = new TrayIcon(Resource1.Happy_smiley_face); Assert.IsNotNull(icon.NotifyIcon); //---------------Test Result ----------------------- }