Exemplo n.º 1
0
        public bool IsColorValidatedForBand(Band band, string color)
        {
            var bandColorValue = new BandColorValue()
            {
                Band = band, Color = color
            };
            var sp = new BandColorSpecification(bandColorValue);

            if (sp.IsSatisfiedBy(bandColorValue))
            {
                var value = colors.GetAllBandColors().Where(sp.ToExpression()).SingleOrDefault();
                return(value != null);
            }
            return(false);
        }
Exemplo n.º 2
0
        public double GetValue(Band band, string color)
        {
            var bandColorValue = new BandColorValue()
            {
                Band = band, Color = color
            };
            var sp = new BandColorSpecification(bandColorValue);

            if (sp.IsSatisfiedBy(bandColorValue))
            {
                var value = colors.GetAllBandColors().Where(sp.ToExpression()).SingleOrDefault();
                if (value == null)
                {
                    throw new ColorNotFoundException(bandColorValue.Band);
                }
                return(value.Value);
            }
            return(0);
        }