Exemple #1
0
        public static void InvalidText(string value)
        {
            var result = TimestampParser.TryParseTimestamp(value, out var int64Timestamp);

            result.Should().BeFalse();
            int64Timestamp.Should().Be(0L);
        }
Exemple #2
0
        public static void ParseValidIso8601String(string value, long expected)
        {
            var result = TimestampParser.TryParseTimestamp(value, out var int64Timestamp);

            result.Should().BeTrue();
            int64Timestamp.Should().Be(expected);
        }
        public void TimestampParser_GivenTimestampOutOfRangeMessage_ReturnsTrue()
        {
            var  parser = new TimestampParser();
            long timestamp;
            bool result = parser.TryParseTimestamp(TEST_TIMESTAMP_MESSAGE, out timestamp);

            Assert.IsTrue(result);
        }
        public void TimestampParser_GivenUnparsableMessage_ReturnsFalse()
        {
            var  parser = new TimestampParser();
            long timestamp;
            bool result = parser.TryParseTimestamp("timestamp", out timestamp);

            Assert.IsFalse(result);
        }
        public void TimestampParser_GivenTimestampOutOfRangeMessage_ParsesTimestampOutOfIt()
        {
            var  parser = new TimestampParser();
            long timestamp;

            parser.TryParseTimestamp(TEST_TIMESTAMP_MESSAGE, out timestamp);
            Assert.AreEqual(TEST_TIMESTAMP, timestamp);
        }