interface IPoint
{
int X { get; }
int Y { get; }
}
static bool CoincidesWith(this IPoint self, IPoint other); // implementation unknown
の意味に関する私の仮定を検証する NUnit テストを書きたいと思いますCoincidesWith。
self.CoincidesWith(other)⇔ (self.X=other.X) ∧ (self.Y=other.Y)
以下は、これまでに思いついた最も簡潔なテストです。
[Theory]
void CoincidesWith_Iff_CoordinatesAreEqual(IPoint self, IPoint other)
{
bool coordinatesAreEqual = (self.X == other.X && self.Y == other.Y);
Assert.That(self.CoincidesWith(other) == coordinatesAreEqual);
}
私の質問は、重要度の高い順に次のとおりです。
- の代わりに
[Theory]を使用するのは、間違っている、または悪いスタイルと見なされますか? (ドキュメンテーションは、後者を と組み合わせて使用することを示唆しているようです。 )Assert.ThatAssume.That[Theory] [Theory]このケースは実際に aよりも aに適してい[Test]ますか?