title: Create unit test for Windows Form. .Net C#
body: <p>There is form in which there are controls(textboxes,buttons). </p>
  
  <pre><code>public partial class Form1 : Form
      {
  
  
          public MWLogin()
          {
              InitializeComponent();
          }
  
          private void btnOK_Click(object sender, EventArgs e)
          {
                  this.DialogResult = System.Windows.Forms.DialogResult.OK;
  
  
            }
  
      //there is text box!
  
          private void txtbox_SelectedIndexChanged(object sender, EventArgs e)
              {
              if(!String.IsNullorEmpty(txtbox.Text))
              {
                  btnOK.Enabled = true;   //for example
              }
          }
  }
  </code></pre>
  
  <p>And in unit test should be getting Text from the txtBox 
  for example: (not correct)</p>
  
  <pre><code>[TestMethod()]
              public void Form1Test()
              {
              try
              {
  
                  MWLogin target = new MWLogin();
                  if(MWLogin.ShowDialog() == DialogResult.OK)
                  {
                        string a = MWLogin.txtBox.Text; //this is no correct
                  }
  
                  Assert.IsTrue(true);
              }
              catch (Exception)
              {
                  Assert.Fail();
              }
          }
  </code></pre>
  
  <p>Please help! How get text from <code>txtBox</code> in form ( without static or public property in Form) </p>