Beispiel #1
0
        private string Wear(Command command)
        {
            if (_dressHolder.HasOutfit(OutfitType.Pajama))
            {
                throw new PajamaMustTakeOffViolation();
            }

            var outfit = new ClothingFactory(_temperature, _dressHolder).GetClothingInstance(command)
                         .WearAppropriateOutfit();

            return(outfit);
        }
Beispiel #2
0
        public override string Wear()
        {
            if (!_dressHolder.HasOutfit(OutfitType.Pants))
            {
                throw new PantsMustBePutOnBeforeShoesViolation();
            }

            if (_temperature == Temperature.Cold &&
                !_dressHolder.HasOutfit(OutfitType.Socks))
            {
                throw new SocksMustBePutOnBeforeShoesViolation();
            }

            _dressHolder.AddOutfit(OutfitType.FootWear);

            return(_temperature == Temperature.Hot? Outfit.Sandals.ToDescription():Outfit.Boots.ToDescription());
        }
Beispiel #3
0
        public string WearAppropriateOutfit()
        {
            if (_dressHolder.HasOutfit(_type))
            {
                throw new OnlyOnePieceOfEachClothingAllowedViolation();
            }

            return(Wear());
        }
Beispiel #4
0
        public override string Wear()
        {
            if (!_dressHolder.HasOutfit(OutfitType.Shirt))
            {
                throw new ShirtMustBePutOnBeforeHeadwearViolation();
            }

            _dressHolder.AddOutfit(OutfitType.HeadWear);

            return(_temperature == Temperature.Hot ? Outfit.SunVisor.ToDescription() : Outfit.Hat.ToDescription());
        }
Beispiel #5
0
        public override string Wear()
        {
            if (!_dressHolder.HasOutfit(OutfitType.Shirt))
            {
                throw new ShirtMustBePutOnBeforeJacketViolation();
            }

            if (_temperature == Temperature.Hot)
            {
                throw new CannotPutJacketOnWhenHotViolation();
            }

            _dressHolder.AddOutfit(OutfitType.Jacket);

            return(Outfit.Jacket.ToDescription());
        }