public void GetBotAbility_WithAbilities_Ability() { var target = new WorldContext(); var bot1 = MockRepository.GenerateMock <IBot> (); var ability1 = MockRepository.GenerateMock <IOneBotAbility>(); var ability2 = MockRepository.GenerateMock <ITwoBotAbility>(); target.AddBot(bot1, ability1, ability2); IBotAbility actual = target.GetBotAbility <IOneBotAbility> (bot1); Assert.AreEqual(ability1, actual); actual = target.GetBotAbility <ITwoBotAbility> (bot1); Assert.AreEqual(ability2, actual); }
public void GetBotAbility_BotNull_Exception() { var target = new WorldContext(); ExceptionAssert.IsThrowing(new ArgumentNullException("bot"), () => { target.GetBotAbility <IOneBotAbility>(null); }); }
public void GetBotAbility_BotNotAdded_Exception() { var target = new WorldContext(); var bot1 = MockRepository.GenerateMock <IBot> (); bot1.Expect(b => b.Name).Return("b1"); ExceptionAssert.IsThrowing(new ArgumentException("Bot 'b1' is not in the world context."), () => { target.GetBotAbility <IOneBotAbility>(bot1); }); }
public void GetBotAbility_WithoutAbility_Null() { var target = new WorldContext(); var bot1 = MockRepository.GenerateMock <IBot> (); var ability1 = MockRepository.GenerateMock <IOneBotAbility>(); target.AddBot(bot1, ability1); var actual = target.GetBotAbility <ITwoBotAbility> (bot1); Assert.IsNull(actual); }