title: Why My Assert Fails? (Exception thrown)
body: <p>I'm using testing in my code, and by my understanding, all a test requires to run in a method is this:</p>
  
  <pre><code>private ClassName(Argument)
  {
      return;
  }
  </code></pre>
  
  <p>So what the test is actually checking is if the "Argument" is the correct output at the end of the method/test.</p>
  
  <p>However in my case the argument passed in has nothing to do with the output. Therefore I am uncertain of how to test it.</p>
  
  <p><strong>NOTE:</strong> The code itself is sound, it outputs the correct variables. Also I actually wrote the test after the code (Big booboo, I know. I want to get into the habit of always testing.)</p>
  
  <p><strong>EDIT:</strong> I believe the issue is to do with the Test being exited via the <code>LoginView.Close</code> and <code>LoginView.Menu.SetMenuView</code>. (The function ends on this line, and the test cannot complete?)</p>
  
  <p>The Location of the <code>return;</code> also affects the rest of the code, so it needs to be at the end of the code. If I move it up, the rest of the code becomes unreachable, and the program breaks.</p>
  
  <p>I have looked for ways to try and bypass the exceptions, and all I have come up with is to test that the exception is actually being thrown correctly. <strong>Is there a way to bypass the exception in the test?</strong></p>
  
  <p>Here is the test:</p>
  
  <pre><code>public void Compare_LoginTest()
  {
      User_LoginView LoginView = new User_LoginView();
      User_Controller.screenName = "ben";
      User_Controller.screenPwd = "password";
      User_Controller.Compare_Login(LoginView);
      int actual = User_Controller.screenAccess;
      int expected = 1;
      Assert.AreEqual(expected, actual);
  }
  </code></pre>
  
  <p>Here is the method being tested:</p>
  
  <pre><code>    public static  void Compare_Login(User_LoginView LoginView)
      {
          // Creates a new oject of User_Model and populates it from the User_Controller.
          User_Model AccessModel = new User_Model();
          AccessModel.Name = screenName;
          AccessModel.Pwd = screenPwd;
  
          // Runs the Login Comparsion in the Database_Facade, and passes in the Model.
          Database_Facade Database = new Database_Facade();
          Database.GetLoginAccess(AccessModel);
          screenAccess = AccessModel.AccessLevel;
          Menu_View.accessLevelSet = AccessModel.AccessLevel;
  
          // Compares the returned AccessLevel. 
          // if it is corect; closes the Login and runs the SetMenuView method,
          // if it is incorrect; shows an error.
          if (AccessModel.AccessLevel &gt; 0)
          {
              Console.WriteLine("Access Level " + AccessModel.AccessLevel);
              // Exception Thrown in testing.
              LoginView.Close();
              LoginView.Menu.SetMenuView();
          }
          else
          {
              ErrorCodes_Controller LoginError = new ErrorCodes_Controller();
              LoginError.WrongLoginError();
          }
          return;
      }
  </code></pre>