private string GetBagEquiptmentAsString(BaggageType type) { string typeAsString = type.ToString(); int index = typeAsString.ToLower().IndexOf("equipment"); return(typeAsString.Substring(0, index)); }
/// <summary> /// Converts baggage equipment type to string. /// </summary> /// <param name="type">Baggage type.</param> /// <returns>Baggage type as string.</returns> /// <example> /// BabyEquipment => baby equipment /// SportsEquipment => sports equipment /// MusicEquipment => music equipment /// </example> private string GetEqyipmentTypeAsString(BaggageType type) { if (type != BaggageType.BabyEquipment && type != BaggageType.SportsEquipment && type != BaggageType.MusicEquipment) { throw new ArgumentException(ErrorMessages.INVALID_BAGGAGE_EQUIPMENT_TYPE); } string typeAsString = type.ToString().ToLower(); int startIndex = typeAsString.IndexOf("equipment"); string intervalToInsert = " "; return(typeAsString.Insert(startIndex, intervalToInsert)); }