示例#1
0
        public bool OrderCondiment(CondimentType condimentType, int quantity)
        {
            if (_currentCup == null)
            {
                return(false);
            }

            ICondimentService service = _condimentServiceFactory.Create(condimentType);

            if (!service.IsCondimentValid(quantity))
            {
                return(false);
            }

            if (_currentCup.Condiments.ContainsKey(condimentType))
            {
                _currentCup.Condiments.Remove(condimentType);
            }

            var condiment = service.OrderCondiment(quantity);

            _currentCup.Condiments.Add(condimentType, condiment);

            return(true);
        }
示例#2
0
 public void SetUp()
 {
     _appSettingsMock = new Mock <IApplicationSettingsService>();
     _service         = new CreamService(_appSettingsMock.Object);
 }