示例#1
0
        public void ParseWithNumberStylesShouldReturnOptionLongNoneWhenStringIsNotExpectedHexNumber()
        {
            // Arrange
            var           s        = "1.0";
            Option <long> expected = None;

            // Act
            var result = LongType.Parse(s, NumberStyles.HexNumber);

            // Assert
            result.Should().Be(expected);
        }
示例#2
0
        public void ParseWithNumberStylesShouldReturnOptionLongNone()
        {
            // Arrange
            var           s        = "not a long";
            Option <long> expected = None;

            // Act
            var result = LongType.Parse(s, NumberStyles.Integer);

            // Assert
            result.Should().Be(expected);
        }
示例#3
0
        public void ParseWithNumberStylesShouldReturnOptionLongSome()
        {
            // Arrange
            var           s        = "1";
            Option <long> expected = Some(1L);

            // Act
            var result = LongType.Parse(s, NumberStyles.Number);

            // Assert
            result.Should().Be(expected);
        }
示例#4
0
        public void ParseShouldReturnOptionLongNone()
        {
            // Arrange
            var           s        = "not a long";
            Option <long> expected = None;

            // Act
            var result = LongType.Parse(s);

            // Assert
            result.Should().Be(expected);
        }
示例#5
0
        public void ParseWithNumberStylesAndFormatProviderShouldReturnOptionLongNone()
        {
            // Arrange
            var             s = "p1$234";
            IFormatProvider formatProvider = new NumberFormatInfo()
            {
                PositiveSign = "p"
            };
            Option <long> expected = None;

            // Act
            var result = LongType.Parse(s, NumberStyles.Integer, formatProvider);

            // Assert
            result.Should().Be(expected);
        }
示例#6
0
        public void ParseWithFormatProviderShouldReturnOptionLongSome()
        {
            // Arrange
            var             s = "p1234";
            IFormatProvider formatProvider = new NumberFormatInfo()
            {
                PositiveSign = "p"
            };

            Option <long> expected = Some(1234L);

            // Act
            var result = LongType.Parse(s, formatProvider);

            // Assert
            result.Should().Be(expected);
        }