コード例 #1
0
        public void IntegrationTest_CostCalculatorRule1_Given_SampleData_should_expectedCost_beEqual_with_actualCost(string insurerName,
                                                                                                                     decimal expectedCost)
        {
            var customerRequest    = DataGenerator_sample1.GenerateCustomerRequest();
            var insurer            = DataGenerator_sample1.GetInsurer(insurerName);
            var matchingEngine     = new MatchingEngineRule1() as IMatchingEngineRule;
            var filterRequestItems = new FilterRequestItemsRule1() as IFilterRequestItemsRule;

            var sut = new CostCalculatorRule1(matchingEngine, filterRequestItems) as ICostCalculatorRule;

            var actualCost = sut.GetCost(customerRequest.covers, insurer);

            Assert.Equal(expectedCost, actualCost);
        }
コード例 #2
0
        public void Test_QuoteEngine_with_Valid_data()
        {
            var req = DataGenerator_sample1.GenerateCustomerRequest();
            var config = DataGenerator_sample1.GenerateInsurerConfig();

            var matchingEngine = new MatchingEngineRule1() as IMatchingEngineRule;
            var filterRequestItems = new FilterRequestItemsRule1() as IFilterRequestItemsRule;
            var costCalculator = new CostCalculatorRule1(matchingEngine , filterRequestItems) as ICostCalculatorRule;
            
            IEngineQuoteService sut = new EngineQuoteService( costCalculator);

            var myQuotes = sut.GetQuotes(req, config);

            Assert.Equal(8, myQuotes[0].Price);
            Assert.Equal((decimal) 7.5, myQuotes[1].Price);
        }