Update dependencies, replace Moq with NSubstitute
This commit is contained in:
@@ -10,15 +10,16 @@ public class AcrobaticsTests
|
||||
public async Task ChangeBasePower_UserNotHoldingItem_BasePowerDoubles()
|
||||
{
|
||||
// Arrange
|
||||
var move = new Mock<IExecutingMove>();
|
||||
var target = new Mock<IPokemon>();
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
var target = Substitute.For<IPokemon>();
|
||||
byte basePower = 10;
|
||||
move.Setup(m => m.User).Returns(new Mock<IPokemon>().Object);
|
||||
move.Setup(m => m.User.HeldItem).Returns((IItem?)null);
|
||||
var user = Substitute.For<IPokemon>();
|
||||
user.HeldItem.Returns((IItem?)null);
|
||||
move.User.Returns(user);
|
||||
var acrobatics = new Acrobatics();
|
||||
|
||||
// Act
|
||||
acrobatics.ChangeBasePower(move.Object, target.Object, 0, ref basePower);
|
||||
acrobatics.ChangeBasePower(move, target, 0, ref basePower);
|
||||
|
||||
// Assert
|
||||
await Assert.That(basePower).IsEqualTo((byte)20);
|
||||
@@ -28,15 +29,16 @@ public class AcrobaticsTests
|
||||
public async Task ChangeBasePower_UserHoldingItem_BasePowerUnchanged()
|
||||
{
|
||||
// Arrange
|
||||
var move = new Mock<IExecutingMove>();
|
||||
var target = new Mock<IPokemon>();
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
var target = Substitute.For<IPokemon>();
|
||||
byte basePower = 10;
|
||||
move.Setup(m => m.User).Returns(new Mock<IPokemon>().Object);
|
||||
move.Setup(m => m.User.HeldItem).Returns(new Mock<IItem>().Object);
|
||||
var user = Substitute.For<IPokemon>();
|
||||
user.HeldItem.Returns(Substitute.For<IItem>());
|
||||
move.User.Returns(user);
|
||||
var acrobatics = new Acrobatics();
|
||||
|
||||
// Act
|
||||
acrobatics.ChangeBasePower(move.Object, target.Object, 0, ref basePower);
|
||||
acrobatics.ChangeBasePower(move, target, 0, ref basePower);
|
||||
|
||||
// Assert
|
||||
await Assert.That(basePower).IsEqualTo((byte)10);
|
||||
@@ -46,15 +48,16 @@ public class AcrobaticsTests
|
||||
public async Task ChangeBasePower_UserNotHoldingItem_NoOverflow()
|
||||
{
|
||||
// Arrange
|
||||
var move = new Mock<IExecutingMove>();
|
||||
var target = new Mock<IPokemon>();
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
var target = Substitute.For<IPokemon>();
|
||||
byte basePower = 200;
|
||||
move.Setup(m => m.User).Returns(new Mock<IPokemon>().Object);
|
||||
move.Setup(m => m.User.HeldItem).Returns((IItem?)null);
|
||||
var user = Substitute.For<IPokemon>();
|
||||
move.User.Returns(user);
|
||||
user.HeldItem.Returns((IItem?)null);
|
||||
var acrobatics = new Acrobatics();
|
||||
|
||||
// Act
|
||||
acrobatics.ChangeBasePower(move.Object, target.Object, 0, ref basePower);
|
||||
acrobatics.ChangeBasePower(move, target, 0, ref basePower);
|
||||
|
||||
// Assert
|
||||
await Assert.That(basePower).IsEqualTo(byte.MaxValue);
|
||||
|
||||
Reference in New Issue
Block a user