示例#1
0
        public IBounds GetBounds(string riskLevel)
        {
            if (string.IsNullOrWhiteSpace(riskLevel))
            {
                throw new ArgumentException("Risk level unknown");
            }

            IBounds bounds;

            switch (riskLevel.ToLower())
            {
            case "low":
                bounds = new LowRiskBounds();
                break;

            case "medium":
                bounds = new MediumRiskBounds();
                break;

            case "high":
                bounds = new HighRiskBounds();
                break;

            default:
                throw new ArgumentException("Risk level is out of bounds");
            }

            return(bounds);
        }
        public IBounds GetBounds(RiskLevel riskLevel)
        {
            IBounds bounds;

            switch (riskLevel)
            {
            case RiskLevel.low:
                bounds = new LowRiskBounds();
                break;

            case RiskLevel.medium:
                bounds = new MediumRiskBounds();
                break;

            case RiskLevel.high:
                bounds = new HighRiskBounds();
                break;

            default:
                throw new ArgumentException("Risk level is out of bounds");
            }

            return(bounds);
        }