public void Size_SizeOfModifierItemList_Verified() { var itemMock1 = new Mock <IModifierItem>(); var itemMock2 = new Mock <IModifierItem>(); var modifier = new Modifier(); modifier.Add(itemMock1.Object); modifier.Add(itemMock2.Object); Assert.Equal(2, modifier.Size()); }
private void Test_Add_ChainAdd() { var a = new Modifier(); //0, 0 var b = new Modifier(2); //2, 2 var c = new Modifier(always1, rolld4, 1); //2, 3 var d = new Modifier(always1, new List <RollType>() { RollType.d12, RollType.d12 }, 3); //5, 7 var e = new Modifier(always1, new List <RollType>() { RollType.d20, RollType.d20, RollType.d20 }, 2); //5, 8 IModifier res = null; Assert.DoesNotThrow(() => res = a.Add(b)); Assert.DoesNotThrow(() => res = res.Add(c)); Assert.DoesNotThrow(() => res = res.Add(d)); Assert.DoesNotThrow(() => res = res.Add(e)); Assert.IsNotNull(res); Assert.AreEqual(14, res.Get()); //0+2+2+5+5 = 14 Assert.AreEqual(20, res.GetCrit()); //0+2+3+7+8 = 20 }
public void Add_AddsModifierItemToList_Added() { var itemMock = new Mock <IModifierItem>(); var modifier = new Modifier(); modifier.Add(itemMock.Object); Assert.Equal(1, modifier.Size()); }
private void Test_Add_SingleAddNoValues() { var testMod = new Modifier(); var mod0 = new Modifier(); Assert.DoesNotThrow(() => testMod.Add(mod0)); Assert.AreEqual(0, testMod.Get()); Assert.AreEqual(0, testMod.GetCrit()); }
private void Test_Add_SingleAddHasRollAndMod() { var testMod = new Modifier(always10, rolld12, 2); var mod13 = new Modifier(always10, rolld20, 3); IModifier res = null; Assert.DoesNotThrow(() => res = testMod.Add(mod13)); Assert.IsNotNull(res); Assert.AreEqual(25, res.Get()); Assert.AreEqual(45, res.GetCrit()); }
private void Test_Add_SingleAddNoRollHasMod() { var testMod = new Modifier(4); var mod3 = new Modifier(3); IModifier res = null; Assert.DoesNotThrow(() => res = testMod.Add(mod3)); Assert.IsNotNull(res); Assert.AreEqual(7, res.Get()); Assert.AreEqual(7, res.GetCrit()); }
public void Start_NGramUnedit() { var mock = new Mock <IModifierItem>(); var ngram1 = new NGram(10, new List <string>()); mock.Setup(foo => foo.Edit(ngram1)).Returns(ngram1); var modifier = new Modifier(); modifier.Add(mock.Object); var result = modifier.Start(ngram1); Assert.Equal(ngram1, result); }
private void Test_Add_SingleAddMultlDice() { var testMod = new Modifier(always10, new List <RollType>() { RollType.d20, RollType.d20, RollType.d20 }, 1); var mod42 = new Modifier(always10, new List <RollType>() { RollType.d12, RollType.d12, RollType.d12, RollType.d12 }, 2); IModifier res = null; Assert.DoesNotThrow(() => res = testMod.Add(mod42)); Assert.IsNotNull(res); var y = res.GetCrit(); Assert.AreEqual(73, res.Get()); Assert.AreEqual(143, res.GetCrit()); }
private void Test_Add_NullArg() { IModifier mod = new Modifier(); Assert.Throws <ArgumentNullException>(() => mod.Add(null)); }