using NUnit.Framework; namespace Funique.Test { public sealed partial class ManagerTest { /// /// Testing the counter functionality
/// ------------------------------------------------
/// 測試計時器元件功能 ///
public sealed class CounterTest { Counter c1; Counter c2; int r1; int r2; [OneTimeSetUp] public void Setup() { c1 = new Counter(0.5f, false); c2 = new Counter(0.5f, true); c1.OnTimeUp += () => r1++; c2.OnTimeUp += () => r2++; } [Test] public void NotLoopOneTest() { c1.Update(0.6f); c1.Update(0.6f); c1.Update(0.6f); c1.Update(0.6f); Assert.AreEqual(1, r1, "Not loop counter result should be 1, after long time"); } [Test] public void LoopOneTest() { c2.Update(0.6f); c2.Update(0.6f); c2.Update(0.6f); c2.Update(0.6f); Assert.AreEqual(4, r2, "Loop counter result should be 4, after 4 update time"); } } } }