1
0

SessionGateTests.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using OneShot.Core;
  2. using Xunit;
  3. namespace OneShot.Tests
  4. {
  5. public class SessionGateTests
  6. {
  7. [Fact]
  8. public void HasEnteredScene_IsFalse_Initially()
  9. {
  10. SessionGate gate = new SessionGate();
  11. Assert.False(gate.HasEnteredScene);
  12. }
  13. [Fact]
  14. public void MarkEnteredScene_SetsFlagTrue()
  15. {
  16. SessionGate gate = new SessionGate();
  17. gate.MarkEnteredScene();
  18. Assert.True(gate.HasEnteredScene);
  19. }
  20. [Fact]
  21. public void Reset_ClearsFlag()
  22. {
  23. SessionGate gate = new SessionGate();
  24. gate.MarkEnteredScene();
  25. gate.Reset();
  26. Assert.False(gate.HasEnteredScene);
  27. }
  28. [Fact]
  29. public void ShouldBlockStart_IsTrue_WhenEnabledAndEntered()
  30. {
  31. SessionGate gate = new SessionGate();
  32. gate.MarkEnteredScene();
  33. Assert.True(gate.ShouldBlockStart(true));
  34. }
  35. [Fact]
  36. public void ShouldBlockStart_IsFalse_WhenEnabledButNotEntered()
  37. {
  38. SessionGate gate = new SessionGate();
  39. Assert.False(gate.ShouldBlockStart(true));
  40. }
  41. [Fact]
  42. public void ShouldBlockStart_IsAlwaysFalse_WhenDisabled()
  43. {
  44. SessionGate gate = new SessionGate();
  45. gate.MarkEnteredScene();
  46. Assert.False(gate.ShouldBlockStart(false));
  47. }
  48. }
  49. }