public void Default() { // Arrange var intelligence = Mock.Of <IAbilityScore>(); var mockAbilityScores = new Mock <IAbilityScoreSection>(); mockAbilityScores.Setup(abs => abs.Intelligence) .Returns(intelligence); var mockCharacter = new Mock <ICharacter>(); mockCharacter.Setup(c => c.AbilityScores) .Returns(mockAbilityScores.Object); string craftType = "Robot"; // Act var craft = new Craft(mockCharacter.Object, craftType); // Assert Assert.AreSame(intelligence, craft.KeyAbilityScore); Assert.AreEqual("Craft (Robot)", craft.ToString()); Assert.IsFalse(craft.ArmorCheckPenaltyApplies); Assert.IsTrue(craft.CanBeUsedUntrained); }
public Game[] getGameList(Craft playerCraft, Craft opponentCraft, Deck playerDeck, Deck opponentDeck, Mode mode, Turn turn) { try { List <Game> matchingGames = new List <Game>(); foreach (Game game in mDataBase.games) { if ((playerCraft == Craft.All || game.playerCraft == playerCraft) && (opponentCraft == Craft.All || game.opponentCraft == opponentCraft) && (playerDeck == null || game.playerDeckID == playerDeck.id) && (opponentDeck == null || game.opponentDeckID == opponentDeck.id) && (mode == Mode.All || game.mode == mode) && (turn == Turn.All || ((turn == Turn.First) == game.first))) { matchingGames.Add(game); } } return(matchingGames.ToArray()); } catch (Exception x) { Console.WriteLine("Exception occurred getting game list for [" + playerCraft.ToString() + "," + opponentCraft.ToString() + "]: " + x.ToString()); } return(new Game[] { }); }
public Deck[] getDeckList(Craft craft) { try { List <Deck> decks = mDataBase.decks; if (craft == Craft.All) { return(decks.ToArray()); } else { List <Deck> result = new List <Deck>(); foreach (Deck deck in decks) { if (deck.craft == craft) { result.Add(deck); } } return(result.ToArray()); } } catch (Exception x) { Console.WriteLine("Exception occurred while getting decklist for craft " + craft.ToString() + ": " + x.ToString()); } return(new Deck[] { }); }