public void SelectAllFromTable() { var selectedCollections = collectionsSelector.SelectAllFrom("CollectionTable"); Assert.That(selectedCollections, Has.Count.EqualTo(4) .And.ContainKey(string.Empty) .And.ContainKey("name") .And.ContainKey("collection") .And.ContainKey("sub-collection")); Assert.That(selectedCollections[string.Empty], Is.Empty); Assert.That(selectedCollections["name"], Is.EquivalentTo(new[] { "entry 1", "entry 2" })); Assert.That(selectedCollections["collection"], Is.EquivalentTo(new[] { "entry 2", "entry 3", "collection", "sub-collection" })); Assert.That(selectedCollections["sub-collection"], Is.EquivalentTo(new[] { "entry 3", "entry 4", "sub-collection" })); }
private Dictionary <string, IEnumerable <string> > GetReplacementTargetsAndTables(string source, bool allowSingle) { var replacements = collectionsSelector.SelectAllFrom(TableNameConstants.Collections.Set.ReplacementStrings); var matchingReplacements = replacements .Where(kvp => source.Contains(kvp.Key)) .Where(kvp => allowSingle || kvp.Value.Count() > 1) .ToDictionary(kvp => kvp.Key, kvp => kvp.Value); return(matchingReplacements); }
public Dictionary <string, IEnumerable <TypeAndAmountSelection> > SelectAll(string tableName) { var table = collectionSelector.SelectAllFrom(tableName); var typesAndAmounts = new Dictionary <string, IEnumerable <TypeAndAmountSelection> >(); foreach (var kvp in table) { typesAndAmounts[kvp.Key] = kvp.Value.Select(e => Parse(e)).ToArray(); //INFO: We want to execute this immediately, so random rolls are not re-iterated and re-rolled } return(typesAndAmounts); }
public Dictionary <string, int> SelectAllFrom(string tableName) { var collectionTable = collectionsSelector.SelectAllFrom(tableName); var adjustmentTable = new Dictionary <string, int>(); foreach (var kvp in collectionTable) { adjustmentTable[kvp.Key] = GetAdjustment <int>(kvp.Value); } return(adjustmentTable); }
public IEnumerable <FeatSelection> SelectFeats() { var featData = collectionsSelector.SelectAllFrom(TableNameConstants.Collection.FeatData); var featSelections = new List <FeatSelection>(); foreach (var dataKVP in featData) { var featSelection = SelectFeat(dataKVP); featSelections.Add(featSelection); } return(featSelections); }
public void SelectAllFrom_ReturnsInnerResult() { var collections = new Dictionary <string, IEnumerable <string> >(); collections["my entry"] = new[] { "entry 1", "entry 2" }; collections["my other entry"] = new[] { "entry 3", "entry 4" }; mockInnerSelector .Setup(s => s.SelectAllFrom("my table")) .Returns(collections); var result = proxy.SelectAllFrom("my table"); Assert.That(result, Is.EqualTo(collections)); }
public Dictionary <string, IEnumerable <string> > SelectAllFrom(string tableName) { return(innerSelector.SelectAllFrom(tableName)); }
public bool ItemTypeCanBeSpecificCursedItem(string itemType) { var itemTypes = collectionsSelector.SelectAllFrom(TableNameConstants.Collections.Set.SpecificCursedItemItemTypes); return(itemTypes.Values.SelectMany(v => v).Contains(itemType)); }