예제 #1
0
        public void LongArgument_ParseShouldFail_BecauseNumberIsTooLow()
        {
            // Arrange
            LongArgument  argument = new LongArgument(minimum: 0L);
            IStringReader reader   = new StringReader("-10");

            // Act
            ReadResults readResults = argument.Parse(reader, out _);

            // Assert
            Assert.IsFalse(readResults.Successful);
        }
예제 #2
0
        public void LongResult_ShouldHaveCorrectValue()
        {
            // Arrange
            LongArgument  argument = new LongArgument();
            IStringReader reader   = new StringReader("123");

            // Act
            argument.Parse(reader, out long result);

            // Assert
            Assert.AreEqual(result, 123L);
        }
예제 #3
0
        public void LongArgument_ParseShouldFail_BecauseInvalidLong()
        {
            // Arrange
            LongArgument  argument = new LongArgument();
            IStringReader reader   = new StringReader("1.5");

            // Act
            ReadResults readResults = argument.Parse(reader, out _);

            // Assert
            Assert.IsFalse(readResults.Successful);
        }
예제 #4
0
        public void LongArgument_ParseShouldSucceed()
        {
            // Arrange
            LongArgument  argument = new LongArgument();
            IStringReader reader   = new StringReader("123");

            // Act
            ReadResults readResults = argument.Parse(reader, out _);

            // Assert
            Assert.IsTrue(readResults.Successful);
        }