Esempio n. 1
0
        public void ParseWithNumberStylesShouldReturnOptionFloatNoneWhenStringIsNotExpectedHexNumber()
        {
            // Arrange
            var            s        = "1.0";
            Option <float> expected = None;

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

            // Assert
            result.Should().Be(expected);
        }
Esempio n. 2
0
        public void ParseWithNumberStylesShouldReturnOptionFloatNone()
        {
            // Arrange
            var            s        = "not a float";
            Option <float> expected = None;

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

            // Assert
            result.Should().Be(expected);
        }
Esempio n. 3
0
        public void ParseShouldReturnOptionFloatSome()
        {
            // Arrange
            var            s        = "1.1";
            Option <float> expected = Some(1.1F);

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

            // Assert
            result.Should().Be(expected);
        }
Esempio n. 4
0
        public void ParseWithNumberStylesAndFormatProviderShouldReturnOptionFloatNone()
        {
            // Arrange
            var             s = "p1$234";
            IFormatProvider formatProvider = new NumberFormatInfo()
            {
                PositiveSign = "p"
            };
            Option <float> expected = None;

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

            // Assert
            result.Should().Be(expected);
        }
Esempio n. 5
0
        public void ParseWithFormatProviderShouldReturnOptionFloatSome()
        {
            // Arrange
            var             s = "p1234";
            IFormatProvider formatProvider = new NumberFormatInfo()
            {
                PositiveSign = "p"
            };

            Option <float> expected = Some(1234F);

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

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