-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathSimpleScriptableEventTest.cs
More file actions
31 lines (27 loc) · 999 Bytes
/
SimpleScriptableEventTest.cs
File metadata and controls
31 lines (27 loc) · 999 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System.Collections.Generic;
using System.Linq;
using CHARK.ScriptableEvents.Events;
using NUnit.Framework;
using UnityEngine;
namespace CHARK.ScriptableEvents.Tests.Runtime
{
[TestFixture]
internal class SimpleScriptableEventTest
{
// Requires additional test case as SimpleScriptableEvent introduces a new method.
[Test]
public void ShouldRaiseEventWithoutArgument()
{
var capturedArgs = new List<SimpleArg>();
var mockScriptableEventListener = new MockScriptableEventListener<SimpleArg>
{
Action = capturedArgs.Add
};
var simpleScriptableEvent = ScriptableObject.CreateInstance<SimpleScriptableEvent>();
simpleScriptableEvent.AddListener(mockScriptableEventListener);
simpleScriptableEvent.Raise();
Assert.AreEqual(1, capturedArgs.Count);
Assert.AreEqual(SimpleArg.Instance, capturedArgs.First());
}
}
}