Create a gist now

Instantly share code, notes, and snippets.

@kihira /HandPanelTest.cs Secret
Created Apr 18, 2016

What would you like to do?
using UnityEngine;
using NUnit.Framework;
[TestFixture]
public class HandPanelTest
{
[Test]
public void LogSorting()
{
//Arrange
var handInfoPanel = Object.Instantiate(GameObject.Find("Player/Hand Mount")).GetComponent<HandInfoPanel>();
handInfoPanel.logs.Clear();
var logData1 = new LogData { title = "Test 1", message = "Test Message" };
var logData2 = new LogData { title = "Test 2", message = "Test Message 2" };
var logData3 = new LogData { title = "Test 3", message = "Test Mssge 3" };
//Act
//Add logs
handInfoPanel.Attach(null, logData1);
handInfoPanel.Attach(null, logData2);
handInfoPanel.Attach(null, logData3);
//Assert
//Logs in correct order - shortest to longest
Assert.AreEqual(logData3.title, handInfoPanel.logs[0].title);
Assert.AreEqual(logData1.title, handInfoPanel.logs[1].title);
Assert.AreEqual(logData2.title, handInfoPanel.logs[2].title);
//Clean
Object.DestroyImmediate(handInfoPanel);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment