Skip to content

Commit

Permalink
Fix or suppress inspection errors by NUnit Analyzers
Browse files Browse the repository at this point in the history
  • Loading branch information
nowsprinting committed Nov 11, 2023
1 parent 6bd31d5 commit f1a6831
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Assets/APIExamples/Tests/Runtime/NUnit/ConstraintExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ public void DelayedConstraint_Test属性のテストでは無効()
{
var start = Time.time; // The time at the beginning of this frame

Assert.That(Time.time, Is.GreaterThan(start + 2.0f).After(2500)); // ミリ秒しか指定できない模様
Assert.That(() => Time.time, Is.GreaterThan(start + 2.0f).After(2500)); // ミリ秒しか指定できない模様
// 失敗時メッセージ例:
// Expected: greater than 2.33228302f after 2500 millisecond delay
// But was: 0.33228299f
Expand All @@ -914,7 +914,7 @@ public async Task DelayedConstraint_AsyncTestでも無効()
var start = Time.time; // The time at the beginning of this frame
await Task.Delay(0);

Assert.That(Time.time, Is.GreaterThan(start + 2.0f).After(2500)); // ミリ秒しか指定できない模様
Assert.That(() => Time.time, Is.GreaterThan(start + 2.0f).After(2500)); // ミリ秒しか指定できない模様
// 失敗時メッセージ例:
// Expected: greater than 2.33228302f after 2500 millisecond delay
// But was: 0.33228299f
Expand All @@ -927,7 +927,7 @@ public IEnumerator DelayedConstraint_UnityTest属性のテストでも無効()
var start = Time.time; // The time at the beginning of this frame
yield return null;

Assert.That(Time.time, Is.GreaterThan(start + 2.0f).After(2500)); // ミリ秒しか指定できない模様
Assert.That(() => Time.time, Is.GreaterThan(start + 2.0f).After(2500)); // ミリ秒しか指定できない模様
// 失敗時メッセージ例:
// Expected: greater than 2.39063787f after 2500 millisecond delay
// But was: 0.390637904f
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// This software is released under the MIT License.

using System.Collections;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using NUnit.Framework;
using UnityEngine.TestTools;
Expand Down Expand Up @@ -54,6 +55,9 @@ public float GetDamageMultiplier_土金の相性によるダメージ倍率は
[TestCase(Element.Wood, Element.Fire, 2.0f)]
[TestCase(Element.Wood, Element.Water, 0.5f)]
[TestCase(Element.Wood, Element.None, 1.0f)]
[SuppressMessage("ReSharper", "NUnit.TestCaseAttributeRequiresExpectedResult")]
[SuppressMessage("Structure",
"NUnit1007:The method has non-void return type, but no result is expected in ExpectedResult")]
public IEnumerator UnityTestでTestCase属性は使用できない(Element def, Element atk, float expected)
{
yield return null;
Expand Down

0 comments on commit f1a6831

Please sign in to comment.