Skip to content

Instantly share code, notes, and snippets.

@lordcodes
Last active November 20, 2016 20:39
Show Gist options
  • Save lordcodes/27901a1cf331f7a70554f743b5e11875 to your computer and use it in GitHub Desktop.
Save lordcodes/27901a1cf331f7a70554f743b5e11875 to your computer and use it in GitHub Desktop.
Format for writing a C# Unity test class
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