コード例 #1
0
        public void CollectionSetup()
        {
            collectionMapper = GetNewInstanceOf <CollectionMapper>();

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

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

            Assert.That(specificAttributes, Is.EquivalentTo(specificCursedAttributes[item]));
        }
コード例 #4
0
ファイル: GameController.cs プロジェクト: DanielKloss/Geek
        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);
        }
コード例 #5
0
        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]));
        }
コード例 #6
0
        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));
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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));
        }
コード例 #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]);
        }
コード例 #10
0
 public void CollectionsSetup()
 {
     CollectionMapper = GetNewInstanceOf <CollectionMapper>();
     table            = CollectionMapper.Map(tableName);
 }
コード例 #11
0
        public IEnumerable <string> Call(string tableName, string name)
        {
            var table = collectionsMapper.Map(tableName);

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

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

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