public void SelectMultipleTypesAndConsistentRandomAmounts() { var entries = new[] { TypeAndAmountHelper.Build("type", "amount"), TypeAndAmountHelper.Build("other type", "other amount"), }; mockCollectionSelector.Setup(s => s.SelectFrom("table name", "name")).Returns(entries); SetUpRoll("amount", 42); SetUpRoll("other amount", 600); var typesAndAmounts = selector.Select("table name", "name"); Assert.That(typesAndAmounts.Count, Is.EqualTo(2)); Assert.That(typesAndAmounts.First().Type, Is.EqualTo("type")); Assert.That(typesAndAmounts.First().Amount, Is.EqualTo(42)); Assert.That(typesAndAmounts.Last().Type, Is.EqualTo("other type")); Assert.That(typesAndAmounts.Last().Amount, Is.EqualTo(600)); Assert.That(typesAndAmounts.First().Type, Is.EqualTo("type")); Assert.That(typesAndAmounts.First().Amount, Is.EqualTo(42)); Assert.That(typesAndAmounts.Last().Type, Is.EqualTo("other type")); Assert.That(typesAndAmounts.Last().Amount, Is.EqualTo(600)); }
public void SelectMultipleTypesAndAmounts() { var entries = new[] { TypeAndAmountHelper.Build("type", "9266"), TypeAndAmountHelper.Build("other type", "90210"), }; mockCollectionSelector.Setup(s => s.SelectFrom("table name", "name")).Returns(entries); SetUpRoll("9266", 42); SetUpRoll("90210", 600); var typesAndAmounts = selector.Select("table name", "name"); Assert.That(typesAndAmounts.Count, Is.EqualTo(2)); var first = typesAndAmounts.First(); var last = typesAndAmounts.Last(); Assert.That(first.Type, Is.EqualTo("type")); Assert.That(first.Amount, Is.EqualTo(42)); Assert.That(last.Type, Is.EqualTo("other type")); Assert.That(last.Amount, Is.EqualTo(600)); }
public void BuildSkillTypeAndAmountData(string skill, string focus) { var skillString = SkillConstants.Build(skill, focus); var typeAndAmount = TypeAndAmountHelper.Build(skillString, "9266"); Assert.That(typeAndAmount, Is.EqualTo(skillString + "@9266")); }
public void SelectAllTypesAndConsistentRandomAmounts() { var table = new Dictionary <string, IEnumerable <string> >(); mockCollectionSelector.Setup(s => s.SelectAllFrom("table name")).Returns(table); table["name"] = new[] { TypeAndAmountHelper.Build("type", "amount"), TypeAndAmountHelper.Build("other type", "other amount"), }; table["other name"] = new[] { TypeAndAmountHelper.Build("other type", "other amount"), TypeAndAmountHelper.Build("another type", "another amount"), }; SetUpRoll("amount", 1337); SetUpRoll("other amount", 1234, 2345); SetUpRoll("another amount", 3456); var typesAndAmounts = selector.SelectAll("table name"); Assert.That(typesAndAmounts.Count, Is.EqualTo(2)); Assert.That(typesAndAmounts["name"].Count, Is.EqualTo(2)); Assert.That(typesAndAmounts["name"].First().Type, Is.EqualTo("type")); Assert.That(typesAndAmounts["name"].First().Amount, Is.EqualTo(1337)); Assert.That(typesAndAmounts["name"].Last().Type, Is.EqualTo("other type")); Assert.That(typesAndAmounts["name"].Last().Amount, Is.EqualTo(1234)); Assert.That(typesAndAmounts["other name"].Count, Is.EqualTo(2)); Assert.That(typesAndAmounts["other name"].First().Type, Is.EqualTo("other type")); Assert.That(typesAndAmounts["other name"].First().Amount, Is.EqualTo(2345)); Assert.That(typesAndAmounts["other name"].Last().Type, Is.EqualTo("another type")); Assert.That(typesAndAmounts["other name"].Last().Amount, Is.EqualTo(3456)); Assert.That(typesAndAmounts["name"].Count, Is.EqualTo(2)); Assert.That(typesAndAmounts["name"].First().Type, Is.EqualTo("type")); Assert.That(typesAndAmounts["name"].First().Amount, Is.EqualTo(1337)); Assert.That(typesAndAmounts["name"].Last().Type, Is.EqualTo("other type")); Assert.That(typesAndAmounts["name"].Last().Amount, Is.EqualTo(1234)); Assert.That(typesAndAmounts["other name"].Count, Is.EqualTo(2)); Assert.That(typesAndAmounts["other name"].First().Type, Is.EqualTo("other type")); Assert.That(typesAndAmounts["other name"].First().Amount, Is.EqualTo(2345)); Assert.That(typesAndAmounts["other name"].Last().Type, Is.EqualTo("another type")); Assert.That(typesAndAmounts["other name"].Last().Amount, Is.EqualTo(3456)); }
public void SelectASingleTypeAndRandomAmount() { var entries = new[] { TypeAndAmountHelper.Build("type", "amount"), TypeAndAmountHelper.Build("other type", "other amount"), }; mockCollectionSelector.Setup(s => s.SelectFrom("table name", "name")).Returns(entries); SetUpRoll("amount", 42); var typeAndAmount = selector.SelectOne("table name", "name"); Assert.That(typeAndAmount.Type, Is.EqualTo("type")); Assert.That(typeAndAmount.Amount, Is.EqualTo(42)); }
public void SelectASingleSkillTypeAndAmount(string skill, string focus) { var skillString = SkillConstants.Build(skill, focus); var entries = new[] { TypeAndAmountHelper.Build(skillString, "9266"), }; mockCollectionSelector.Setup(s => s.SelectFrom("table name", "name")).Returns(entries); SetUpRoll("9266", 42); var typeAndAmount = selector.SelectOne("table name", "name"); Assert.That(typeAndAmount.Type, Is.EqualTo(skillString)); Assert.That(typeAndAmount.Amount, Is.EqualTo(42)); }
protected void AssertTypesAndAmounts(string name, Dictionary <string, string> typesAndAmounts) { var entries = typesAndAmounts.Select(kvp => TypeAndAmountHelper.Build(kvp.Key, kvp.Value)).ToArray(); AssertDistinctCollection(name, entries); }
public void BuildTypeAndAmountData() { var data = TypeAndAmountHelper.Build("type", "amount"); Assert.That(data, Is.EqualTo("type@amount")); }