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 9: Solution",
"description": "This section will introduce you to the custom UnityTest Attribute, which allows for creating test that runs over multiple frames.",
"interactiveImport": true
}

View File

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

View File

@@ -0,0 +1,15 @@
using System;
using UnityEngine;
namespace PlayModeTests_9s
{
public class MovementScript : MonoBehaviour
{
public Vector3 velocity;
private void Update()
{
transform.position += velocity * Time.deltaTime;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2f340775b94f41f08128da874cbf6b8e
timeCreated: 1670840831

View File

@@ -0,0 +1,6 @@
{
"name": "PlayModeTests_9s",
"optionalUnityReferences": [
"TestAssemblies"
]
}

View File

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

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.TestTools;
namespace PlayModeTests_9s
{
public class SkippingFrameTests
{
private GameObject PrepareCube()
{
var go = GameObject.CreatePrimitive(PrimitiveType.Cube);
var rb = go.AddComponent<MovementScript>();
rb.velocity = Vector3.down * 5;
return go;
}
[UnityTest]
public IEnumerator CubeMovesDown()
{
var cubeUnderTest = PrepareCube();
var initialPosition = cubeUnderTest.transform.position;
yield return null;
Assert.That(cubeUnderTest.transform.position, Is.Not.EqualTo(initialPosition));
}
}
}

View File

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