public void TestToStringMethods() { Assert.AreEqual("1d4", DieRollDetails.From("1d4").ToString()); Assert.AreEqual("3d6", DieRollDetails.From("3d6").ToString()); Assert.AreEqual("5d8+1", DieRollDetails.From("5d8+1").ToString()); Assert.AreEqual("7d10+3", DieRollDetails.From("7d10+3").ToString()); Assert.AreEqual("9d12(cold)", DieRollDetails.From("9d12(cold)").ToString()); Assert.AreEqual("6d12(fire),3d4+2(cold)", DieRollDetails.From("6d12(fire),3d4+2(cold)").ToString()); Assert.AreEqual("3d12(necrotic/radiant),3d4+2(cold),1d20", DieRollDetails.From("3d12(necrotic/radiant),3d4+2(cold),1d20").ToString()); }
public void TestSpellcastingAbilityModifier() { DieRollDetails rollDetails = DieRollDetails.From("1d4+SAM(health)", +3); Assert.AreEqual(1, rollDetails.Rolls.Count); Assert.AreEqual(3, rollDetails.Rolls[0].Offset); Assert.AreEqual(4, rollDetails.Rolls[0].Sides); Assert.AreEqual("(health)", rollDetails.Rolls[0].Descriptor); Assert.AreEqual("1d4+3(health)", rollDetails.ToString()); }
public void TestDieRollDetails() { Roll roll = DieRollDetails.From("3d12").Rolls[0]; Assert.AreEqual("3d12", roll.ToString()); roll.Offset = 4; Assert.AreEqual("3d12+4", roll.ToString()); roll.Descriptor = "(necrotic)"; Assert.AreEqual("3d12+4(necrotic)", roll.ToString()); DieRollDetails rollDetails = DieRollDetails.From("1d4"); Assert.AreEqual(1, rollDetails.Rolls.Count); Assert.AreEqual(0, rollDetails.Rolls[0].Offset); Assert.AreEqual(4, rollDetails.Rolls[0].Sides); Assert.AreEqual("", rollDetails.Rolls[0].Descriptor); Assert.AreEqual("1d4", rollDetails.ToString()); rollDetails = DieRollDetails.From("3d8+3(cold)"); Assert.AreEqual(1, rollDetails.Rolls.Count); Assert.AreEqual(3, rollDetails.Rolls[0].Count); Assert.AreEqual(3, rollDetails.Rolls[0].Offset); Assert.AreEqual(8, rollDetails.Rolls[0].Sides); Assert.AreEqual("(cold)", rollDetails.Rolls[0].Descriptor); Assert.AreEqual("3d8+3(cold)", rollDetails.ToString()); rollDetails = DieRollDetails.From("2d10+3(cold),5d6(fire)"); Assert.AreEqual(2, rollDetails.Rolls.Count); Assert.AreEqual(2, rollDetails.Rolls[0].Count); Assert.AreEqual(3, rollDetails.Rolls[0].Offset); Assert.AreEqual(10, rollDetails.Rolls[0].Sides); Assert.AreEqual("(cold)", rollDetails.Rolls[0].Descriptor); Assert.AreEqual("2d10+3(cold),5d6(fire)", rollDetails.ToString()); Assert.AreEqual(5, rollDetails.Rolls[1].Count); Assert.AreEqual(0, rollDetails.Rolls[1].Offset); Assert.AreEqual(6, rollDetails.Rolls[1].Sides); Assert.AreEqual("(fire)", rollDetails.Rolls[1].Descriptor); }