title: is this a correct way to test a presenter
body: <p>i'm creating a shopping website using web forms and MVP pattern in a three layered architecture. i also decided to do the validation and type castings inside of presenter class.for testing framework i use NUnit and for my mocks i use NSubstitude. here is my category model class:</p>
  
  <pre><code>    //we're doing Dependency injection here.
      public abstract class BaseRepository
      {
          EntityContext context;
          public BaseRepository()
          {
               context = new EntityContext();
          }
          public EntityContext Context
          {
               get { return context; }
          }
      }
      public class CategoryRepository : BaseRepository
      {
          public int Add(long id, string name)
          {
              Category cat = new Category();
              cat.Id = id;
              cat.Name = name;
              Context.Category.Add(cat);
              Context.SaveChanges();
          }
      }
  </code></pre>
  
  <p>here is the category presenter:</p>
  
  <pre><code>    public class CategoryPresenter : BasePresenter //has nothing but a dependency property to Logger
      {
          BaseRepository _model;
          IView _view;
          public CategoryPresenter(IView view)
          {
              _model = new CategoryRepository();
              _view = view;
          }
          public void Add()
          {
              //havn't passed the tests yet since i'm not sure if i'm on the correct path.
              //whatever validation, loggin and type casting will go here.
              _model.Add(_view.CategoryId, _view.CategoryName);
          }
      }
  </code></pre>
  
  <p>and here is the test class for the presenter:</p>
  
  <pre><code>    [Test]
      public void Add_NullId_ThrowException()
      {
          _view.CategoryId.Returns(p =&gt; null);
          _view.CategoryName.Returns(p =&gt; "test");
          Assert.Throws(typeof(InvalidOperationException), _presenter.Add());
      }
      [Test]
      public void Add_EmptyId_ThrowException()
      {
          _view.CategoryId.Returns(p =&gt; "");
          _view.CategoryName.Returns(p =&gt; "test");
          Assert.Throws(typeof(InvalidOperationException), _presenter.Add());
      }
      [Test]
      public void Add_SpaceOnlyId_ThrowException()
      {
          _view.CategoryId.Returns(p =&gt; " ");
          _view.CategoryName.Returns(p =&gt; "test");
          Assert.Throws(typeof(InvalidOperationException), _presenter.Add());
      }
      [Test]
      public void Add_InvalidLowBoundId_ThrowException()
      {
          _view.CategoryId.Returns(p =&gt; "-1");
          _view.CategoryName.Returns(p =&gt; "test");
          Assert.Throws(typeof(InvalidOperationException), _presenter.Add());
      }
      [Test]
      public void Add_InvalidHighBoundId_ThrowException()
      {
          _view.CategoryId.Returns(p =&gt; long.MaxValue.ToString() + "1");
          _view.CategoryName.Returns(p =&gt; "test");
          Assert.Throws(typeof(InvalidOperationException), _presenter.Add());
      }
  
      [Test]
      public void Add_EmptyName_ThrowException()
      {
          _view.CategoryId.Returns(p =&gt; "1");
          _view.CategoryName.Returns(p =&gt; "");
          Assert.Throws(typeof(InvalidOperationException), _presenter.Add());
      }
      [Test]
      public void Add_NullName_ThrowException()
      {
          _view.CategoryId.Returns(p =&gt; "1");
          _view.CategoryName.Returns(p =&gt; null);
          Assert.Throws(typeof(InvalidOperationException), _presenter.Add());
      }
      [Test]
      public void Add_SpaceOnlyName_ThrowException()
      {
          _view.CategoryId.Returns(p =&gt; "1");
          _view.CategoryName.Returns(p =&gt; " ");
          Assert.Throws(typeof(InvalidOperationException), _presenter.Add());
      }
      [Test]
      public void Add_NumberOnlyName_ThrowException()
      {
          _view.CategoryId.Returns(p =&gt; "1");
          _view.CategoryName.Returns(p =&gt; "123");
          Assert.Throws(typeof(InvalidOperationException), _presenter.Add());
      }
  </code></pre>
  
  <p>am i testing correctly? i mean is this what the test class should look like? i'm i missing something? is this too much? like "you don't need to test emptiness" or any other issues associated with my tests or code? if you notice anything wrong within my whole code and/or architecture i appreciate it if you correct me. thanks!</p>
  
  <p><strong>Update:</strong> IView is inherited by a .aspx page. on code behind i simply call the presenter method from inside of a click event that user is triggered by pressing a button. as for memory i havn't gone that far yet. simply stuck on TDD.</p>