public void AttackCreatures_WhenAttackerCreatureIdentifierIsNull_SHouldTHrowArgument() { var mockedFactory = new Mock<ICreaturesFactory>(); var mockedLogger = new Mock<ILogger>(); var manager = new BattleManager(mockedFactory.Object, mockedLogger.Object); var identifier = CreatureIdentifier.CreatureIdentifierFromString("Angel(1)"); Assert.Throws<ArgumentException>(() => manager.Attack(null, identifier)); }
public void Attack_WhenDefenderCreatureIdentifierIsNull_ShouldThrowArgumentException() { // Arrange var mockedFactory = new Mock<ICreaturesFactory>(); var mockedLogger = new Mock<ILogger>(); var battleManager = new BattleManager(mockedFactory.Object, mockedLogger.Object); // The code itself should be refactored. Think about sealed class to be changed or the static method itself // You could use an unconstrained Mocking framework var identifier = CreatureIdentifier.CreatureIdentifierFromString("Pesho(1)"); // Act & Assert Assert.Throws<ArgumentException>(() => battleManager.Attack(identifier, identifier)); }