コード例 #1
0
        public string Customer_TypeA_Given_Preference(params string[] rawCustomerDetails)
        {
            // When multiple customers arrive at same time, with same number of items, Customer "TypeA" chooses first.
            var customers             = new CustomerInitializer(rawCustomerDetails).Initialize();
            var customerQueueResolver = new CustomerQueueResolver();

            var firstCustomer = customerQueueResolver.Resolve(customers).First();

            return(string.Format("{0} {1} {2}",
                                 firstCustomer.SelectionStrategy.GetType() == typeof(TypeASelectionStrategy) ? "A" : "B",
                                 firstCustomer.TimeToQueue,
                                 firstCustomer.Items));
        }
コード例 #2
0
        public string Customers_With_Fewer_Items_Given_Preference(params string[] rawCustomerDetails)
        {
            // When multiple customers arrive at same time, those with fewer items get to choose register first.
            var customers             = new CustomerInitializer(rawCustomerDetails).Initialize();
            var customerQueueResolver = new CustomerQueueResolver();

            var firstCustomer = customerQueueResolver.Resolve(customers).First();

            return(string.Format("{0} {1} {2}",
                                 firstCustomer.SelectionStrategy.GetType() == typeof(TypeASelectionStrategy) ? "A" : "B",
                                 firstCustomer.TimeToQueue,
                                 firstCustomer.Items));
        }