This commit is contained in:
2025-01-17 13:10:42 +01:00
commit 4536213c91
15115 changed files with 1442174 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
{
"displayName": "Exercise 13: Solution",
"description": "In this section, you will learn how to invoke and wait for Domain Reloads.",
"interactiveImport": true
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 02e9541bc4afe044aa73d73fe2b147f1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,72 @@
using System;
using System.Collections;
using System.IO;
using System.Reflection;
using NUnit.Framework;
using UnityEngine.TestTools;
namespace Tests_13s
{
internal class ScriptAddingTests
{
private const string pathToFile = "Assets/Tests_13s/TempScript.cs";
[UnityTest]
public IEnumerator CreatedScriptIsVerified()
{
CreateScript();
yield return new RecompileScripts();
var verification = VerifyScript();
Assert.That(verification, Is.EqualTo("OK"));
}
[UnityTearDown]
public IEnumerator Teardown()
{
if (!File.Exists(pathToFile))
{
yield break;
}
if (!File.Exists(pathToFile + ".meta"))
{
yield break;
}
File.Delete(pathToFile);
File.Delete(pathToFile + ".meta");
yield return new RecompileScripts();
}
private void CreateScript()
{
try
{
File.WriteAllText(pathToFile, @"
public class MyTempScript {
public string Verify()
{
return ""OK"";
}
}");
}
catch(DirectoryNotFoundException)
{
Assert.Inconclusive("The path to file is incorrect. Please make sure that the path to TempScript is valid.");
}
}
private string VerifyScript()
{
Type type = Type.GetType("MyTempScript", true);
object instance = Activator.CreateInstance(type);
var verifyMethod = type.GetMethod("Verify", BindingFlags.Instance | BindingFlags.Public);
var verifyResult = verifyMethod.Invoke(instance, new object[0]);
return verifyResult as string;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 53559d2747813c743b16a4ff158f9672
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
{
"name": "Tests_13s",
"references": [
"UnityEngine.TestRunner",
"UnityEditor.TestRunner"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll"
],
"autoReferenced": true,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": []
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6e6475f7018ac3b4d8ed5ef6d020aa67
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: