Sto scrivendo i test per la seguente classe:
public class Foo : INotifyPropertyChanged
{
  private int _failCount;
  private int _totalCount;
  public double FailRate
  {
     get
     {
        double returnValue = 0.0;
        if (_totalCount > 0)
        {
           returnValue = (double) _failCount / _totalCount * 100;
        }
        return returnValue;
     }
  }
  public int FailCount
  {
     get { return _failCount; }
     set
     {
        if (value != _failCount)
        {
           _failCount = value;
           onNotifyPropertyChanged();
           onNotifyPropertyChanged("FailRate");
        }
     }
  }
  public int TotalCount
  {
     get { return _totalCount; }
     set
     {
        if (value != _totalCount)
        {
           _totalCount = value;
           onNotifyPropertyChanged();
           onNotifyPropertyChanged("FailRate");
        }
     }
  }
  protected virtual void onNotifyPropertyChanged([CallerMemberName]string name = null)
  {
     if (PropertyChanged != null)
     {
        PropertyChanged(this, new PropertyChangedEventArgs(name));
     }
  }
  public event PropertyChangedEventHandler PropertyChanged;
}
 Stavo scrivendo alcuni test per la proprietà   FailRate   , e mi è venuto in mente che probabilmente dovrei assicurarmi che ottenere   FailRate    non generi un'eccezione. Il caso in cui qualcuno (probabilmente io) rimuove il controllo   if (_totalCount > 0)   , e poi ottiene   FailRate    genera un   DivideBy0Exception   . 
 Quindi ho scritto un test per accertarmi che ottenere   FailRate    non generi un'eccezione. 
[TestMethod]
public void GettingTheFailRateWhenTheTotalCountIsZeroDoesNotThrowAnException()
{
   Defect defect = new Defect();
   defect.FailCount = 0;
   defect.TotalCount = 0;
   double dummy = defect.FailRate;
}
Tuttavia, quel test non ha un controllo esplicito e passerà finché la proprietà non genera un'eccezione.
Sta solo verificando che una proprietà non genera un'eccezione come test "valido"?