Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Tests
- {
- [TestFixture]
- public class HeroTests
- {
- const int experiance = 200;
- [Test]
- public void AttackLogicShouldWorkCorrectly()
- {
- // Arrange
- var weaponMock = Mock.Of<IWeapon>();
- var targetMock = new Mock<ITarget>();
- targetMock.Setup(t => t.IsDead())
- .Returns(true);
- targetMock.Setup(t => t.GiveExperience())
- .Returns(200);
- var hero = new Hero("TestHero", weaponMock);
- // Act
- hero.Attack(targetMock.Object);
- // Assert
- Assert.That(hero.Experience, Is.EqualTo(experiance));
- }
- }
- }
- //
- var fakeTarget = new Mock<ITarget>();
- fakeTarget.SetUp(x => x.TakeAttack(It.IsAny<int>()))
- .Callback(() => hero.Weapon.DirabilityPoints -= 1);
- fakeTarget.SetUp(x => x.Health)
- .Returns(0);
Add Comment
Please, Sign In to add comment