Skip to content

Instantly share code, notes, and snippets.

@thedoritos
Last active January 26, 2016 11:46
Show Gist options
  • Save thedoritos/26a3a3995a1f86e0e91b to your computer and use it in GitHub Desktop.
Save thedoritos/26a3a3995a1f86e0e91b to your computer and use it in GitHub Desktop.
Unit Test with a class extends MonoBehaviour
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