♻️ Refactor repeated Fact test into a Theory test

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

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

Loading…
Cancel
Save