title: How do i assert that a unit tested method return True?
body: <p>This is my Domain class</p>
  
  <pre><code>public partial class Department
  {
      public int DepartmentId { get; set; }
      [Required]
      public string DepartmentCode { get; set; }
      [Required]
      public string DepartmentFullName { get; set; }
      public bool Status { get; set; }
      public System.DateTime CreatedOn { get; set; }
  }
  </code></pre>
  
  <p>In my MVC application, this is how my <code>DepartmentService</code> class looks like.</p>
  
  <pre><code>public class DepartmentService : IDepartmentService
  {
      private IUnitOfWork _UoW;
      private IRepository&lt;Department&gt; repository;
      public DepartmentService(IUnitOfWork UoW)
      {
          _UoW = UoW;
          repository = _UoW.GetRepository&lt;Department&gt;();
      }
  
      public IList&lt;Department&gt; GetAllDepartments()
      {
          return repository.GetAll();
      }
  
      public bool SaveDepartment(Department newDepartment)
      {
          try
          {
              repository.Add(newDepartment);
              _UoW.Save();
          }
          catch (Exception)
          {
              throw;
          }
          return true;
      }
  }
  </code></pre>
  
  <p>I wrote one unit test for GetAllDepartments methods as below. </p>
  
  <pre><code>[Test]
  public void When_GetAllDepartments_Is_Called_RepositoryGetAll_ShouldBeCalled()
  {
      // Arrange
      var mockUnitOfWork = new Mock&lt;IUnitOfWork&gt;();
      var mockRepository = new Mock&lt;IRepository&lt;Department&gt;&gt;();
      mockUnitOfWork.Setup(x =&gt; x.GetRepository&lt;Department&gt;())
                    .Returns(mockRepository.Object);
      var sut = new DepartmentService(mockUnitOfWork.Object);
  
      // Act
      sut.GetAllDepartments();
  
      // Assert
      mockRepository.Verify(x =&gt; x.GetAll());
  }
  </code></pre>
  
  <p>I want to test the <code>SaveDepartment</code> method where, when department is saved successfully, it should return true. I am not able to write unit test for this.</p>
  
  <p>I also want to test when DepartmentCode or DepartmentFullName is blank and if Save is attempted, an exception should be thrown.</p>
  
  <p>This is what i have so far. </p>
  
  <pre><code>[Test]
  public void ShouldSucessfully_SaveNewDepartment()
  {
      // Arrange
      var mockUnitOfWork = new Mock&lt;IUnitOfWork&gt;();
      var mockRepository = new Mock&lt;IRepository&lt;Department&gt;&gt;();
      Department newDept = new Department { 
            CreatedOn = DateTime.Now,
            Status = true, 
            DepartmentFullName = "DFN", 
            DepartmentCode = "DC" };
      mockUnitOfWork.Setup(x =&gt; x.GetRepository&lt;Department&gt;())
                    .Returns(mockRepository.Object);
      var sut = new DepartmentService(mockUnitOfWork.Object);
  
      // Act
      sut.SaveDepartment(newDept);
  
      // Assert 
      // ???
  }
  </code></pre>