public Fruit CreateFruit(FruitTypes type, Position position) { switch (type) { case FruitTypes.Apple: _fruitBuilder = new AppleBuilder(position); break; case FruitTypes.Cherry: _fruitBuilder = new CherryBuilder(position); break; case FruitTypes.Grapes: _fruitBuilder = new GrapesBuilder(position); break; case FruitTypes.Lemon: _fruitBuilder = new LemonBuilder(position); break; case FruitTypes.Orange: _fruitBuilder = new OrangeBuilder(position); break; case FruitTypes.Strawberry: _fruitBuilder = new StrawberryBuilder(position); break; default: throw new ArgumentException($"Not supported fruit type {type}"); } return(_fruitBuilder.Instance); }
public Fruit(string title, string manufacterer, string countryOfManufacturer, IMeasuredValue weight, IMeasuredValue price, IMeasuredValue sugarValue, FruitTypes type) : base(title, manufacterer, countryOfManufacturer, weight, price) { _SugarValue = sugarValue; _Type = type; }
public IFruit GetFruit(FruitTypes fruitType) { switch (fruitType) { case FruitTypes.small: return(new SmallFruit()); case FruitTypes.medium: return(new MediumFruit()); default: return(new BigFruit()); } }