Пример #1
0
        /// <summary>
        ///     Build and return a full hexagon + its adapters, stubbing only the last-miles HTTP calls.
        /// </summary>
        /// <returns></returns>
        public SeatsSuggestionsController BuildImperativeShellWithAdaptersButWithoutIOs()
        {
            // Instantiate the Right-side adapter
            var rightSideAdapter = InstantiateRightSideAdapter(_showId, _theaterJson, _theaterBookedSeatsJson);

            // create impure imperative shell by partially applying the provide function in the core.
            SeatAllocator.SuggestionsDelegate suggestionsDelegate = (id, party) => SeatAllocator.MakeSuggestionsImperativeShell(rightSideAdapter, id, party);

            // Instantiate the Left-side adapter
            var leftSideAdapter = new SeatsSuggestionsController(suggestionsDelegate);

            // Balance restored : Underlying hexagon (essentially the 'main' module) knows how to assemble adapters to core but nothing else

            // Note:
            // - iso injecting the functions into the controller and rightside adapters, these could also be injected by creting more partially applied functions YMMV

            return(leftSideAdapter);
        }
Пример #2
0
 public SeatsSuggestionsController(SeatAllocator.SuggestionsDelegate suggestionDelegate)
 {
     _suggestionsDelegate = suggestionDelegate;
 }