using System; using System.Collections.Generic; using System.Linq; using FsCheck; using FsCheck.Xunit; using Seraphina.Core; using Xunit; namespace Seraphina.Tests { public class SkillInfoTest { static readonly List validList = new List { 1, 2, 3, 4 }; [Fact] public void Ctor_ThrowsOnNullAndEmptyId() { Assert.Throws("id", () => new SkillInfo(null, "test", validList)); Assert.Throws("id", () => new SkillInfo("", "test", validList)); } [Fact] public void Ctor_ThrowsOnNullAndEmptyName() { Assert.Throws("name", () => new SkillInfo("test", null, validList)); Assert.Throws("name", () => new SkillInfo("test", "", validList)); } [Fact] public void Ctor_ThrowsOnNullAndEmptySkillCosts() { Assert.Throws("skillPointCosts", () => new SkillInfo("test", "test", null)); Assert.Throws("skillPointCosts", () => new SkillInfo("test", "test", new List { })); } [Fact] public void Ctor_ThrowsOnNullDescription() { Assert.Throws("description", () => new SkillInfo("test", "test", null, validList)); } public static IEnumerable GetSkillInvalidLengths() { for (int i = 1; i < SkillInfo.NumLevelUpgrades; i++) { yield return new object[] { i }; } } [Theory] [MemberData(nameof(GetSkillInvalidLengths))] public void Ctor_ThrowsWhenSkillCostsTooShort(int length) { var skillCosts = Enumerable.Range(0, length).Select(x => new SkillPoint(x)).ToList(); Assert.Throws("skillPointCosts", () => new SkillInfo("test", "test", skillCosts)); } [Fact] public void Ctor_AcceptsNormalParameters() { var _ = new SkillInfo("test", "test", validList); // Shouldn't do anything special here, just pass. } } }