Skip to content

Commit

Permalink
Add constraint examples
Browse files Browse the repository at this point in the history
  • Loading branch information
nowsprinting committed Oct 29, 2023
1 parent c74e35c commit 01bf967
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions Assets/APIExamples/Tests/Runtime/NUnit/ConstraintExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public void SameAsConstraint_オブジェクトが同一であるとみなせる
public class コレクション
{
[Test]
public void AllItemsConstraint_すべての要素を検証()
public void AllItemsConstraint_すべての要素が条件を満たすこと()
{
var actual = new[] { 2, 3, 5, 6 };

Expand Down Expand Up @@ -285,7 +285,7 @@ public void DictionaryContainsValueConstraint_Dictionaryに値が含まれるこ
}

[Test]
public void EmptyCollectionConstraint_要素が空であること()
public void EmptyConstraint_要素が空であること()
{
var actual = new int[] { };

Expand All @@ -295,6 +295,27 @@ public void EmptyCollectionConstraint_要素が空であること()
// But was: < 0 >
}

[Test]
public void HasCount_コレクションの個数を検証()
{
var actual = new List<int> { 2, 3, 5, 6 };

Assert.That(actual, Has.Count.EqualTo(4));
// 失敗時メッセージ例:
// Expected: property Count equal to 4
// But was: 5
}

[Test]
public void HasLength_配列の個数を検証()
{
var actual = new int[] { 2, 3, 5, 6 };
Assert.That(actual, Has.Length.EqualTo(4));
// 失敗時メッセージ例:
// Expected: property Length equal to 4
// But was: 5
}

[Test]
public void ExactCountConstraint_条件を満たす要素数を検証する()
{
Expand Down

0 comments on commit 01bf967

Please sign in to comment.