public void ShouldReturnICharacterFromMooseWithMock() { IMoose moose = Mock.Create <IMoose>(Behavior.Strict); Mock.Arrange(() => moose.Charge()).Returns(10).MustBeCalled(); Mock.Arrange(() => moose.Run()).Returns(5).MustBeCalled(); ICharacter bullwinkle = new MooseAdapter(moose); //ICharacter bullwinkle = new MooseAdapter(new Moose()); Assert.AreEqual(10, bullwinkle.Attack()); Assert.AreEqual(5, bullwinkle.Chase()); Assert.AreEqual(5, bullwinkle.Flee()); Mock.Assert(moose); Mock.Assert(() => moose.Charge(), Occurs.Exactly(1)); Mock.Assert(() => moose.Run(), Occurs.Exactly(2)); }
public int Attack() => _moose.Charge();