Last active
November 20, 2016 20:39
-
-
Save lordcodes/27901a1cf331f7a70554f743b5e11875 to your computer and use it in GitHub Desktop.
Format for writing a C# Unity test class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace YourNamespace.UnitTests { | |
using UnityEngine; | |
using NUnit.Framework; | |
public class YourClassTest { | |
private YourClass yourClass; | |
[SetUp] | |
public void SetUp() { | |
yourClass = new YourClass(); | |
} | |
[TearDown] | |
public void TearDown() { | |
PlayerPrefs.DeleteAll(); | |
} | |
[Test] | |
public void GivenConditions_WhenActions_ThenAssertions() { | |
int someValue = 10; | |
int expectedResult = 20; | |
int actualResult = yourClass.Actions(someValue); | |
Assert.That(actualResult, Is.EqualTo(expectedResult)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment