♻️ Refactor repeated Fact test into a Theory test

pull/49/head
Alexis Drai 2 years ago
parent ab2febf1b8
commit b65fe617bc

@ -19,27 +19,16 @@ namespace Tests.Model_UTs
Assert.Equal("Alice", player.Name);
}
[Fact]
public void TestConstructorIfWhitespaceThenException()
{
// Arrange
Player player;
// Act
void action() => player = new(" ");
// Assert
Assert.Throws<ArgumentException>(action);
}
[Fact]
public void TestConstructorIfBlankThenException()
[Theory]
[InlineData("")]
[InlineData(" ")]
public void TestConstructorIfWhitespaceOrBlankThenException(string name)
{
// Arrange
Player player;
// Act
void action() => player = new("");
void action() => player = new(name);
// Assert
Assert.Throws<ArgumentException>(action);

Loading…
Cancel
Save