title: Unit testing in visual studio 2010 without a main method
body: <p>Trying to unit test some simple code for a class project, however every time I try to run the test I get an error that there is no home.exe and no main static main method.  However, we haven't gotten to the point where we are supposed to have either of those things yet, so how can I run the test without them?</p>
  
  <p>My code</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  namespace Home
  {
      class InventoryType
      {
  
          /// &lt;summary&gt;
          /// Selects the inventory type and returns the selected value
          /// &lt;/summary&gt;
          public class InventorySelect
          {
              private string inventoryTypes;
              public String InventoryTypes
              {
                  set
                  {
                      inventoryTypes = value;
                  }
  
                  get
                  {
                      return inventoryTypes;
                  }
              }
  
  
              /// &lt;summary&gt;
              /// Validate that the inventory is returning some sort of value
              /// &lt;/summary&gt;
              /// &lt;returns&gt;&lt;/returns&gt;
              public bool Validate()
              {
                  if (InventoryTypes == null) return false;
                  return true;
              }
          }
      }
  }
  </code></pre>
  
  <p>My Test Code</p>
  
  <pre><code>using System;
  using System.Text;
  using System.Collections.Generic;
  using System.Linq;
  using Microsoft.VisualStudio.TestTools.UnitTesting;
  using Home.InventoryType.InventorySelect;
  
  namespace HomeTest
  {
      [TestClass]
      public class TestInventoryTypeCase
      {
          [TestMethod]
          public void TestInventoryTypeClass()
          {
              InventorySelect select = new InventorySelect();
              select.inventoryTypes = "Collection";
  
              if (Validate() = true)
                  Console.WriteLine("Test Passed");
              else
                  if (Validate() = false)
                      Console.WriteLine("Test Returned False");
                  else
                      Console.WriteLine("Test Failed To Run");
  
              Console.ReadLine();
  
          }
      }
  }
  </code></pre>