1- // Copyright (c) 2021-2023 Koji Hasegawa.
1+ // Copyright (c) 2021-2025 Koji Hasegawa.
22// This software is released under the MIT License.
33
44using System ;
1111using UnityEngine ;
1212using UnityEngine . TestTools ;
1313using AssertionException = UnityEngine . Assertions . AssertionException ;
14- #if UNITY_EDITOR
15- using UnityEditor ;
16- #endif
1714
1815#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
1916
@@ -315,7 +312,7 @@ public void HasCount_コレクションの個数を検証()
315312 [ Test ]
316313 public void HasLength_配列の個数を検証 ( )
317314 {
318- var actual = new int [ ] { 2 , 3 , 5 , 6 } ;
315+ var actual = new [ ] { 2 , 3 , 5 , 6 } ;
319316 Assert . That ( actual , Has . Length . EqualTo ( 4 ) ) ;
320317 // 失敗時メッセージ例:
321318 // Expected: property Length equal to 4
@@ -539,8 +536,10 @@ public class ファイルとディレクトリ
539536 [ UnityPlatform ( RuntimePlatform . LinuxEditor , RuntimePlatform . WindowsEditor , RuntimePlatform . OSXEditor ) ]
540537 public void EmptyDirectoryConstraint_ディレクトリが空であること ( )
541538 {
542- #if UNITY_EDITOR
543- var dir = FileUtil . GetUniqueTempPathInProject ( ) ;
539+ var dir = Path . Combine (
540+ Application . temporaryCachePath ,
541+ TestContext . CurrentContext . Test . ClassName ,
542+ TestContext . CurrentContext . Test . Name ) ;
544543 var actual = Directory . CreateDirectory ( dir ) ;
545544
546545 Assert . That ( actual , Is . Empty ) ;
@@ -549,15 +548,16 @@ public void EmptyDirectoryConstraint_ディレクトリが空であること()
549548 // But was: <UnityTempFile-113d9721b8aa84bb0a7bf0b6e31e2638>
550549
551550 Directory . Delete ( dir , true ) ;
552- #endif
553551 }
554552
555553 [ Test ]
556554 [ UnityPlatform ( RuntimePlatform . LinuxEditor , RuntimePlatform . WindowsEditor , RuntimePlatform . OSXEditor ) ]
557555 public void FileOrDirectoryExistsConstraint_ファイルまたはディレクトリが存在すること ( )
558556 {
559- #if UNITY_EDITOR
560- var dir = Path . GetFileName ( FileUtil . GetUniqueTempPathInProject ( ) ) ;
557+ var dir = Path . Combine (
558+ Application . temporaryCachePath ,
559+ TestContext . CurrentContext . Test . ClassName ,
560+ TestContext . CurrentContext . Test . Name ) ;
561561 var directoryInfo = Directory . CreateDirectory ( dir ) ;
562562 var file = Path . Combine ( dir , "test" ) ;
563563 var fileInfo = new FileInfo ( file ) ;
@@ -575,7 +575,6 @@ public void FileOrDirectoryExistsConstraint_ファイルまたはディレクト
575575 // But was: "Temp/UnityTempFile-ac03ee62865a042748c6f54723c2e51b/test"
576576
577577 Directory . Delete ( dir , true ) ;
578- #endif
579578 }
580579
581580 [ Test ]
0 commit comments