Exemple #1
0
        public void TestFirstLineIsNotIntegerThrowsInvalidException()
        {
            var recordFactory = new RecordFactory();

            var inputService = new InputReaderService(recordFactory);

            inputService.ReadInput("bob");
        }
Exemple #2
0
        public void TestThrowsInputInvalidException()
        {
            var recordFactory = new RecordFactory();

            var inputService = new InputReaderService(recordFactory);

            inputService.ReadInput("");
        }
Exemple #3
0
        public void TestMismatchedRowNumbers()
        {
            var recordFactory = new RecordFactory();

            var input = "5" + Environment.NewLine +
                        "VEST,001B,20120101,1000,0.45" + Environment.NewLine +
                        "VEST,002B,20130101,1000,0.50" + Environment.NewLine +
                        "VEST,001B,20130101,1500,0.50" + Environment.NewLine +
                        "VEST,003B,20130101,1000,0.50" + Environment.NewLine +
                        "20140101,1.00";

            var inputService = new InputReaderService(recordFactory);

            var result = inputService.ReadInput(input);
        }
Exemple #4
0
        public void TestValidInputStream()
        {
            var recordFactory = new RecordFactory();

            var input = "5" + Environment.NewLine +
                        "VEST,001B,20120101,1000,0.45" + Environment.NewLine +
                        "VEST,002B,20120101,1500,0.45" + Environment.NewLine +
                        "VEST,002B,20130101,1000,0.50" + Environment.NewLine +
                        "VEST,001B,20130101,1500,0.50" + Environment.NewLine +
                        "VEST,003B,20130101,1000,0.50" + Environment.NewLine +
                        "20140101,1.00";

            var inputService = new InputReaderService(recordFactory);

            var result = inputService.ReadInput(input);

            Assert.IsTrue(result.ShareRecords.Count() == 5);
            Assert.IsTrue(result.MarketPrice.Price == 1.00M);
            Assert.IsTrue(result.MarketPrice.MarketPriceDate == new DateTime(2014, 1, 1));
        }