Skip to content

Commit 4dfcdbe

Browse files
Copilotxezno
andcommitted
Add test to verify entity tick logic implementation
Co-authored-by: xezno <[email protected]>
1 parent 313ad0d commit 4dfcdbe

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
using Mocha;
2+
using Mocha.Common;
3+
4+
namespace Mocha.Tests;
5+
6+
[TestClass]
7+
public class EntityTickTests
8+
{
9+
[TestMethod]
10+
public void TestEntityImplementsTickInterface()
11+
{
12+
// Create a test actor instance
13+
var actor = new TestActor();
14+
15+
// Verify it implements IActor correctly
16+
Assert.IsInstanceOfType(actor, typeof(IActor));
17+
18+
// Verify it has both Update and FrameUpdate methods
19+
var updateMethod = actor.GetType().GetMethod("Update");
20+
var frameUpdateMethod = actor.GetType().GetMethod("FrameUpdate");
21+
22+
Assert.IsNotNull(updateMethod);
23+
Assert.IsNotNull(frameUpdateMethod);
24+
}
25+
26+
[TestMethod]
27+
public void TestIActorInterfaceHasBothMethods()
28+
{
29+
// Verify IActor interface has both required methods
30+
var iactorType = typeof(IActor);
31+
var updateMethod = iactorType.GetMethod("Update");
32+
var frameUpdateMethod = iactorType.GetMethod("FrameUpdate");
33+
34+
Assert.IsNotNull(updateMethod, "IActor interface should have Update method");
35+
Assert.IsNotNull(frameUpdateMethod, "IActor interface should have FrameUpdate method");
36+
}
37+
}
38+
39+
// Test actor for validating interface compliance
40+
public class TestActor : Actor
41+
{
42+
public bool UpdateCalled { get; private set; } = false;
43+
public bool FrameUpdateCalled { get; private set; } = false;
44+
45+
public override void Update()
46+
{
47+
UpdateCalled = true;
48+
base.Update();
49+
}
50+
51+
public override void FrameUpdate()
52+
{
53+
FrameUpdateCalled = true;
54+
base.FrameUpdate();
55+
}
56+
}

0 commit comments

Comments
 (0)