public virtual Result <Empty> Validate(IFigureDescription request)
        {
            ProxyFigureProcessors processor = _storage.GetProxyFigureProcessor(request);

            if (processor == null)
            {
                return(Result <Empty> .MakeFailMessage("error figure"));
            }

            ValidationResult result = processor.Validate(request);

            if (result.IsValid)
            {
                return(Result <Empty> .MakeSucces(Empty.Instance));
            }

            return(Result <Empty> .MakeFail(result.ErrorsToListString()));
        }
Exemple #2
0
        public Result <double> Calculate(IFigureDescription request)
        {
            var processor = _storage.GetProxyFigureProcessor(request);

            if (processor == null)
            {
                return(Result <double> .MakeFailMessage("error figure"));
            }

            Result <Empty> validateResult = _validator.Validate(request);

            if (validateResult.Fail)
            {
                return(Result <double> .MakeFail(validateResult.Errors));
            }

            double result = processor.Calculate(request);

            return(Result <double> .MakeSucces(result));
        }