unity-atoms/UnityAtomsTestsAndExamples/Assets/Tests/ScriptableObjectBaseTest.cs
Jeff Campbell e5f6659eda Removed unused namepaces
* Removed unused namespaces across all files in Unity.Atoms assembly.
* Removed unused namspaces in runtime and Test assembly code.
2019-04-07 11:15:23 +02:00

34 lines
1.2 KiB
C#

using System.Reflection;
using NUnit.Framework;
using UnityAtoms;
using UnityEngine;
namespace Tests
{
public class ScriptableObjectBaseTest
{
[Test]
public void ScriptableObjectBaseTest_EqualityMembers()
{
var fieldinfo = typeof(StringConstant).GetField("value", BindingFlags.NonPublic | BindingFlags.Instance);
var stringConstant = ScriptableObject.CreateInstance<StringConstant>();
fieldinfo.SetValue(stringConstant, "some constant string");
var stringConstant2 = ScriptableObject.CreateInstance<StringConstant>();
fieldinfo.SetValue(stringConstant2, "some constant string");
var stringConstant3 = ScriptableObject.CreateInstance<StringConstant>();
fieldinfo.SetValue(stringConstant3, "some other string");
Assert.AreEqual("some constant string".GetHashCode(), stringConstant.Value.GetHashCode());
Assert.AreEqual("some constant string".GetHashCode(), stringConstant.GetHashCode());
Assert.AreEqual(stringConstant2, stringConstant);
Assert.IsTrue(stringConstant2 == stringConstant);
Assert.IsFalse(stringConstant3 == stringConstant);
}
}
}