Пример #1
0
        public void FromString_WrongDoubleValue_ThrowException()
        {
            // Arrange
            var line = new[] { "2015-08-26T13:04:32", "ABCD", "228.s34" };
            var parser = new QuoteFormatter();

            // Act
            var quote = parser.FromString(line, 1);
        }
Пример #2
0
        public void FromString_WrongFieldNumber_ThrowException()
        {
            // Arrange
            var line = new[] { "2015-08-26T13:04:32", "ABCD" };
            var parser = new QuoteFormatter();

            // Act
            var quote = parser.FromString(line, 1);
        }
Пример #3
0
        public void FromString_ValidParams_Success()
        {
            // Arrange
            var line = new[] { "2015-08-26T13:04:32", "ABCD", "228.34" };

            var expectedQuote = new Quote
            {
                DateTime = new DateTime(2015, 8, 26, 13, 4, 32),
                Ticker = "ABCD",
                ValueExact = (decimal)228.34
            };

            var parser = new QuoteFormatter();

            // Act
            var quote = parser.FromString(line, 1);

            // Assert
            Assert.IsTrue(quote.Equals(expectedQuote));
        }
Пример #4
0
        public void ToString_ValidParams_Success()
        {
            // Arrange
            var quote = new Quote
            {
                DateTime = new DateTime(2015, 8, 26, 13, 4, 32),
                Ticker = "ABCD",
                ValueExact = (decimal)228.34
            };

            var expectedLine = new[] { "2015-08-26T13:04:32", "ABCD", "228.34" };
            var parser = new QuoteFormatter();

            // Act
            var actualLine = parser.ToString(quote);

            // Assert
            Assert.AreEqual(expectedLine, actualLine);
        }