Example #1
0
        public void CollectionSetup()
        {
            collectionMapper = GetNewInstanceOf <CollectionMapper>();

            table   = collectionMapper.Map(tableName);
            indices = new Dictionary <int, string>();
        }
Example #2
0
        public void TableContainsAllSpecialMaterials()
        {
            var materials = TraitConstants.SpecialMaterials.All();
            var table     = CollectionMapper.Map(tableName);

            Assert.That(table.Keys, Is.SupersetOf(materials));
        }
        public void SpecificCursedArmorMatchesAttributes(string item)
        {
            var specificCursedAttributes = CollectionMapper.Map(TableNameConstants.Collections.Set.SpecificCursedItemAttributes);
            var specificAttributes       = GetCollection(item);

            Assert.That(specificAttributes, Is.EquivalentTo(specificCursedAttributes[item]));
        }
Example #4
0
        internal async Task <List <BoardGame> > GetGames(string username)
        {
            _boardGameRepository.DatabaseExists();

            List <BoardGame> baseCollection = new List <BoardGame>();

            //Get collection data from service asynchronously
            string baseCollectionResponse = await _collectionService.GetBaseCollectionOwnedAsync(username);

            //Map data to collection
            baseCollection = await _collectionMapper.Map(baseCollectionResponse);

            List <int> ids = new List <int>();

            //Get detail game data
            foreach (BoardGame game in baseCollection)
            {
                ids.Add(game.boardGameId);
            }

            string response = await _gameService.GetGameDetailsAsync(ids);

            baseCollection = _gameMapper.Map(baseCollection, response);

            return(baseCollection);
        }
        public void SpecificCursedWeaponMatchesAttributes(string item)
        {
            var specificWeaponAttributesTable = string.Format(TableNameConstants.Collections.Formattable.SpecificITEMTYPEAttributes, ItemTypeConstants.Weapon);

            var specificWeaponAttributes = CollectionMapper.Map(specificWeaponAttributesTable);
            var specificCursedAttributes = GetCollection(item);

            Assert.That(specificCursedAttributes, Is.EquivalentTo(specificWeaponAttributes[item]));
        }
        public void AttributesMatchWeapon(string specificWeapon, string weapon)
        {
            var specificWeaponAttributes = table[specificWeapon];

            var weaponAttributesTableName = string.Format(TableNameConstants.Collections.Formattable.ITEMTYPEAttributes, ItemTypeConstants.Weapon);
            var weaponAttributesTable     = CollectionMapper.Map(weaponAttributesTableName);
            var weaponAttributes          = weaponAttributesTable[weapon];

            Assert.That(specificWeaponAttributes, Is.SupersetOf(weaponAttributes));
        }
        public void Map_should_return_list()
        {
            var repository = MockRepository.GenerateStub<IRepository<FakeObject>>();
            repository.Stub(r => r.Load(FakeObject.InstanceIdentifier)).Return(FakeObject.Instance);

            var ids = new string[] { FakeObject.IdentifierValue};

            var mapper = new CollectionMapper<FakeObject>(repository);

            var result = mapper.Map(ids);

            Assert.AreEqual(result.First(), FakeObject.Instance);
        }
        public void Map_two_items_expect_list_with_two_items()
        {
            var repo = MockRepository.GenerateStub<IRepository<FakeObject>>();
            repo.Stub(r => r.Load(FakeObject.InstanceIdentifier)).Return(FakeObject.Instance);
            repo.Stub(r => r.Load(FakeObject.SecondInstanceIdentifier)).Return(FakeObject.SecondInstance);

            var ids = new string[] { FakeObject.IdentifierValue, FakeObject.IdentifierValue2 };

            var mapper = new CollectionMapper<FakeObject>(repo);

            var result = mapper.Map(ids);

            Assert.IsTrue(FakeObject.SortedList.SequenceEqual(result));
        }
Example #9
0
        public Dictionary <string, IEnumerable <string> > Map(string tableName)
        {
            var assembly = assemblyLoader.GetRunningAssembly();
            var key      = assembly.FullName + tableName;

            lock (myLock)
            {
                if (!cachedTables.ContainsKey(key))
                {
                    var mappedTable = innerMapper.Map(tableName);
                    cachedTables.Add(key, mappedTable);
                }
            }

            return(cachedTables[key]);
        }
Example #10
0
 public void CollectionsSetup()
 {
     CollectionMapper = GetNewInstanceOf <CollectionMapper>();
     table            = CollectionMapper.Map(tableName);
 }
Example #11
0
        public IEnumerable <string> Call(string tableName, string name)
        {
            var table = collectionsMapper.Map(tableName);

            return(table[name]);
        }
Example #12
0
 public Dictionary <string, IEnumerable <string> > SelectAllFrom(string tableName)
 {
     return(mapper.Map(tableName));
 }
Example #13
0
        public void MapTableViaMapperWithTestAssembly(string name, params string[] entries)
        {
            var collectionTable = collectionsMapper.Map("TestSelectorCollectionTable");

            Assert.That(collectionTable[name], Is.EquivalentTo(entries));
        }
Example #14
0
 public void AppendXmlFileExtensionToTableName()
 {
     mapper.Map(tableName);
     mockStreamLoader.Verify(l => l.LoadFor(fileName), Times.Once);
 }
        public void ReturnTableFromInnerMapper()
        {
            var result = proxy.Map("table name");

            Assert.That(result, Is.EqualTo(table));
        }