public void GetAutoIncremented_WhenAValidValueMaxIntegerIsPassed_ReturnsZero()
        {
            // Arrange
            var valueToParse = int.MaxValue.ToString();
            var expectedValue = "0";

            // Act
            var versionFormatter = new VersionFormatter();
            var resultValue = versionFormatter.GetAutoIncremented(valueToParse);

            // Assert
            Assert.AreEqual(expectedValue, resultValue);
        }
        public void GetAutoIncremented_WhenAValidValueIsPassed_ReturnsTheValueIncremented()
        {
            // Arrange
            var valueToParse = "9";
            var expectedValue = "10";

            // Act
            var versionFormatter = new VersionFormatter();
            var resultValue = versionFormatter.GetAutoIncremented(valueToParse);

            // Assert
            Assert.AreEqual(expectedValue, resultValue);
        }
        public void GetAutoIncremented_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.GetAutoIncremented(valueToParse);
                Assert.Fail();
            }
            catch (FormatException ex)
            {
                // Assert
                Assert.AreEqual(exceptionMessage, ex.Message);
            }
        }
        private static string ProcessIncrementMethod(VersionFormatter formatter, string number, IncrementMethod incrementMethod, string settedValue = null)
        {
            switch (incrementMethod)
            {
                case IncrementMethod.Setted:
                    if (string.IsNullOrWhiteSpace(settedValue))
                    {
                        throw new ArgumentNullException(nameof(settedValue), $"The value for variable {{{number}}} was not setted.");
                    }

                    number = settedValue;
                    break;
                case IncrementMethod.Julian:
                    number = formatter.GetJulianFormat();
                    break;
                case IncrementMethod.Auto:
                    number = formatter.GetAutoIncremented(number);
                    break;
            }
            return number;
        }
        public void GetAutoIncremented_WhenNoValueIsPassed_ReturnsZero()
        {
            // Act
            var versionFormatter = new VersionFormatter();
            var result = versionFormatter.GetAutoIncremented();

            // Assert
            Assert.AreEqual("0", result);
        }
        public void GetAutoIncremented_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.GetAutoIncremented(valueToParse);
                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException ex)
            {
                // Assert
                Assert.IsTrue(ex.Message.StartsWith(exceptionMessage));
                Assert.AreEqual("value", ex.ParamName);
            }
        }