public void ShouldGetDataFromJsonFile()
        {
            var             filePath = @"..\..\..\test-case.json";
            ImportTestCases test     = new ImportTestCases(filePath);
            var             data     = test.GetJsonDataIntoObject();

            Assert.IsNotNull(data);

            IReservationRepository repo = new ReservationRepository(test);
            var reservations            = repo.GetReservations();

            Assert.IsNotNull(reservations);

            ICampsiteRepository campsiteRepository = new CampsiteRepository(test);
            var campsites = campsiteRepository.GetCampsites();

            Assert.IsNotNull(campsites);

            ISearchQueryRepository searchQueryRepository = new SearchQueryRepository(test);
            var searchQuery = searchQueryRepository.GetSearchQuery();

            Assert.IsNotNull(searchQuery);

            IGapRuleRepository gapRuleRepository = new GapRuleRepository(test);
            var gapRules = gapRuleRepository.GetGapRules();

            Assert.IsNotNull(gapRules);
        }
예제 #2
0
        public ReservationRuleChain(GapRuleRepository gapRuleRepository)
        {
            ConcurrencyRule    concurrencyRule = new ConcurrencyRule();
            GapReservationRule gapRule         = new GapReservationRule(gapRuleRepository);
            DefaultRule        defaultRule     = new DefaultRule();

            concurrencyRule.SetSuccessor(gapRule);
            gapRule.SetSuccessor(defaultRule);

            _startOfChain = concurrencyRule;
        }
예제 #3
0
        public static IReservationEngine Create(string filename)
        {
            ImportTestCases       test = new ImportTestCases(filename);
            ReservationRepository reservationRepository = new ReservationRepository(test);
            CampsiteRepository    campsiteRepository    = new CampsiteRepository(test);
            GapRuleRepository     gapRuleRepository     = new GapRuleRepository(test);
            ReservationRuleChain  ruleChain             = new ReservationRuleChain(gapRuleRepository);
            IReservationEngine    engine = new ReservationEngine(reservationRepository, campsiteRepository, ruleChain);

            return(engine);
        }