Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions Assets/APIExamples/Tests/Runtime/NUnit/ConstraintExample.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021-2023 Koji Hasegawa.
// Copyright (c) 2021-2025 Koji Hasegawa.
// This software is released under the MIT License.

using System;
Expand All @@ -11,9 +11,6 @@
using UnityEngine;
using UnityEngine.TestTools;
using AssertionException = UnityEngine.Assertions.AssertionException;
#if UNITY_EDITOR
using UnityEditor;
#endif

#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously

Expand Down Expand Up @@ -315,7 +312,7 @@ public void HasCount_コレクションの個数を検証()
[Test]
public void HasLength_配列の個数を検証()
{
var actual = new int[] { 2, 3, 5, 6 };
var actual = new[] { 2, 3, 5, 6 };
Assert.That(actual, Has.Length.EqualTo(4));
// 失敗時メッセージ例:
// Expected: property Length equal to 4
Expand Down Expand Up @@ -539,8 +536,10 @@ public class ファイルとディレクトリ
[UnityPlatform(RuntimePlatform.LinuxEditor, RuntimePlatform.WindowsEditor, RuntimePlatform.OSXEditor)]
public void EmptyDirectoryConstraint_ディレクトリが空であること()
{
#if UNITY_EDITOR
var dir = FileUtil.GetUniqueTempPathInProject();
var dir = Path.Combine(
Application.temporaryCachePath,
TestContext.CurrentContext.Test.ClassName,
TestContext.CurrentContext.Test.Name);
var actual = Directory.CreateDirectory(dir);

Assert.That(actual, Is.Empty);
Expand All @@ -549,15 +548,16 @@ public void EmptyDirectoryConstraint_ディレクトリが空であること()
// But was: <UnityTempFile-113d9721b8aa84bb0a7bf0b6e31e2638>

Directory.Delete(dir, true);
#endif
}

[Test]
[UnityPlatform(RuntimePlatform.LinuxEditor, RuntimePlatform.WindowsEditor, RuntimePlatform.OSXEditor)]
public void FileOrDirectoryExistsConstraint_ファイルまたはディレクトリが存在すること()
{
#if UNITY_EDITOR
var dir = Path.GetFileName(FileUtil.GetUniqueTempPathInProject());
var dir = Path.Combine(
Application.temporaryCachePath,
TestContext.CurrentContext.Test.ClassName,
TestContext.CurrentContext.Test.Name);
var directoryInfo = Directory.CreateDirectory(dir);
var file = Path.Combine(dir, "test");
var fileInfo = new FileInfo(file);
Expand All @@ -575,7 +575,6 @@ public void FileOrDirectoryExistsConstraint_ファイルまたはディレクト
// But was: "Temp/UnityTempFile-ac03ee62865a042748c6f54723c2e51b/test"

Directory.Delete(dir, true);
#endif
}

[Test]
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021-2023 Koji Hasegawa
Copyright (c) 2021-2025 Koji Hasegawa

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down