Exemple #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);
        }
Exemple #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>());
        }
Exemple #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);
        }
Exemple #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>());
        }
Exemple #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);
        }
Exemple #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}");
            }
        }