public void NormalizeTFSBuildNumber_WhenPassedANegativeValidInteger_ThrowsArgumentOutOfRangeException() { // Arrange var valueToParse = "-5"; var exceptionMessage = $"The argument with value [{valueToParse}] it's out of valid range, only positive integers and zero are accepted."; // Act var versionFormatter = new VersionFormatter(); try { versionFormatter.NormalizeTFSBuildNumber(valueToParse); Assert.Fail(); } catch (ArgumentOutOfRangeException ex) { // Assert Assert.IsTrue(ex.Message.StartsWith(exceptionMessage)); Assert.AreEqual("tfsBuildNumber", ex.ParamName); } }
public void NormalizeTFSBuildNumber_WhenNoValueIsPassed_ReturnsZero() { // Act var versionFormatter = new VersionFormatter(); var result = versionFormatter.NormalizeTFSBuildNumber(); // Assert Assert.AreEqual("0", result); }
public void NormalizeTFSBuildNumber_WhenAValidValueIsPassed_ReturnsTheValueDecremented() { // Arrange var valueToParse = "9"; var expectedValue = "8"; // Act var versionFormatter = new VersionFormatter(); var resultValue = versionFormatter.NormalizeTFSBuildNumber(valueToParse); // Assert Assert.AreEqual(expectedValue, resultValue); }
public void NormalizeTFSBuildNumber_WhenAZeroValidIsPassed_ReturnsZero() { // Arrange var valueToParse = "0"; var expectedValue = "0"; // Act var versionFormatter = new VersionFormatter(); var resultValue = versionFormatter.NormalizeTFSBuildNumber(valueToParse); // Assert Assert.AreEqual(expectedValue, resultValue); }
public void NormalizeTFSBuildNumber_WhenAnInvalidStringValueIsPassed_ThrowsFormatException() { // Arrange var valueToParse = "not_valid_value"; var exceptionMessage = $"The argument with value [{valueToParse}] cannot be converted to a valid integer."; // Act var versionFormatter = new VersionFormatter(); try { versionFormatter.NormalizeTFSBuildNumber(valueToParse); Assert.Fail(); } catch (FormatException ex) { // Assert Assert.AreEqual(exceptionMessage, ex.Message); } }