Last active
January 26, 2016 11:46
-
-
Save thedoritos/26a3a3995a1f86e0e91b to your computer and use it in GitHub Desktop.
Unit Test with a class extends MonoBehaviour
This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Threading; | |
using NUnit.Framework; | |
using UnityEngine; | |
namespace UnityTest | |
{ | |
internal class Subject : MonoBehaviour | |
{ | |
public int Add(int a, int b) | |
{ | |
return a + b; | |
} | |
} | |
internal class CalculatorTest | |
{ | |
[Test] | |
public void AddOneToOne() | |
{ | |
var obj = new GameObject(); | |
obj.AddComponent<Subject>(); | |
var subject = obj.GetComponent<Subject>(); | |
Assert.AreEqual(2, subject.Add(1, 1), "1 + 1 should be eq to 2"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment