public void TestPush() { var stack = new ApplicationStateStack <TestEnum>(); var state = new TestApplicationStateV1(); stack.RegisterState(TestEnum.V1, state); stack.Push(TestEnum.V1); Assert.IsFalse(stack.IsBusy); Assert.AreEqual(stack.States.Count(), 1); Assert.IsTrue(stack.IsCurrent(TestEnum.V1)); }
public void TestPopWithoutError() { Assert.DoesNotThrow(() => { var stack = new ApplicationStateStack <TestEnum>(); stack.RegisterState(TestEnum.V1, new TestApplicationStateV1()); stack.Set(TestEnum.V1); stack.Pop(); Assert.IsFalse(stack.IsBusy); Assert.AreEqual(stack.States.Count(), 0); Assert.IsFalse(stack.IsCurrent(TestEnum.V1)); }); }
public void TestPushWithMuchStates() { var stack = new ApplicationStateStack <TestEnum>(); var state1 = new TestApplicationStateV1(); var state2 = new TestApplicationStateV2(); stack.RegisterState(TestEnum.V1, state1); stack.RegisterState(TestEnum.V2, state2); stack.Set(TestEnum.V1); stack.Push(TestEnum.V2); Assert.IsFalse(stack.IsBusy); Assert.AreEqual(stack.States.Count(), 2); Assert.IsTrue(stack.IsCurrent(TestEnum.V2)); }