using MultiversalDiplomacy.Model; using NUnit.Framework; namespace MultiversalDiplomacyTests.Model; public class TimelineFactoryTest { [TestCase(0, "a")] [TestCase(1, "b")] [TestCase(25, "z")] [TestCase(26, "aa")] [TestCase(27, "ab")] [TestCase(51, "az")] [TestCase(52, "ba")] [TestCase(53, "bb")] [TestCase(77, "bz")] [TestCase(78, "ca")] public void RoundTripTimelineKeys(int number, string designation) { Assert.That(TimelineFactory.IntToString(number), Is.EqualTo(designation), "Incorrect string"); Assert.That(TimelineFactory.StringToInt(designation), Is.EqualTo(number), "Incorrect number"); } [TestCase("a0", "a", 0)] [TestCase("a1", "a", 1)] [TestCase("a10", "a", 10)] [TestCase("aa2", "aa", 2)] [TestCase("aa22", "aa", 22)] public void SeasonKeySplit(string key, string timeline, int turn) { Assert.That(TimelineFactory.SplitKey(key), Is.EqualTo((timeline, turn)), "Failed to split key"); } [Test] public void NoSharedFactoryState() { TimelineFactory one = new(); TimelineFactory two = new(); Assert.That(one.NextTimeline(), Is.EqualTo("a")); Assert.That(one.NextTimeline(), Is.EqualTo("b")); Assert.That(one.NextTimeline(), Is.EqualTo("c")); Assert.That(two.NextTimeline(), Is.EqualTo("a")); Assert.That(two.NextTimeline(), Is.EqualTo("b")); } }