Exemplo n.º 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);

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

            return(leftSideAdapter);
        }
Exemplo n.º 2
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);
        }