Esempio n. 1
0
        public void Engine_Validate_NotEnoughtMarketMoney_Throws_Error(string amount)
        {
            var input = new[] { Helpers.GetCsvFileFullPath(), amount };

            Assert.That(() => {
                var service = new QuoteEngine();
                var output  = service.GetQuote(input);
            }, Throws.TypeOf <Core.Validation.ValidationException>(), LendQuoteProvider.ErrorUnavailableMarketMoney);
        }
Esempio n. 2
0
        public void Engine_Validate_InvalidAmmount_Throws_Error(string amount)
        {
            var input = new[] { Helpers.GetCsvFileFullPath(), amount };

            Assert.That(() => {
                var service = new QuoteEngine();
                var output  = service.GetQuote(input);
            }, Throws.TypeOf <Core.Validation.ValidationException>());
        }
Esempio n. 3
0
        public void Engine_Validate_InputWrongParams_Throws_Error()
        {
            var input = new[] { "1000" };

            Assert.That(() => {
                var service = new QuoteEngine();
                var output  = service.GetQuote(input);
            }, Throws.TypeOf <Core.Validation.ValidationException>(), QuoteEngine.ErrorWrongParams);
        }
Esempio n. 4
0
        public void Engine_Validate_WrongFileName_Throws_Error()
        {
            var input = new[] { "somefile", "1000" };

            Assert.That(() => {
                var service = new QuoteEngine();
                var output  = service.GetQuote(input);
            }, Throws.TypeOf <Core.Validation.ValidationException>());
        }
Esempio n. 5
0
        public void Engine_FullTest_OK()
        {
            var input = new[] { Helpers.GetCsvFileFullPath(), "1000" };

            var service = new QuoteEngine();
            var output  = service.GetQuote(input);

            Assert.AreEqual(ExpectedOutputForFullTest, output);
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            try {
                var service = new QuoteEngine();
                var output  = service.GetQuote(args);

                Console.WriteLine(output);
            }
            catch (ValidationException vex) {
                Console.WriteLine(vex.Message);
            }
            catch (Exception ex) {
                Console.WriteLine($"We encounter an error while trying to get your quote: {ex.Message}");
            }
        }