Esempio n. 1
0
        /// <summary>
        /// Инициализация параметров представления модели.
        /// </summary>
        public PhotoFrameViewModel()
        {
            const double minHeight            = 1.0f;
            const double minForLengthAndWidth = 5.0f;
            const double max         = 100.0f;
            const double maxInterval = 6.0f;
            const double value       = 5.0f;

            var outerWidth = new BorderConditions(minForLengthAndWidth,
                                                  max, max);
            var outerHeight = new BorderConditions(minHeight,
                                                   value, minForLengthAndWidth);
            var outerLength = new BorderConditions(minForLengthAndWidth,
                                                   max, max);
            var innerHeight = new BorderConditions(minHeight,
                                                   value, minForLengthAndWidth);
            var interval = new BorderConditions(minHeight,
                                                value, maxInterval);

            _photoFrame = new PhotoFrameTemplate(outerWidth,
                                                 outerHeight,
                                                 outerLength,
                                                 innerHeight,
                                                 interval);

            _builder = new BuilderPhotoFrame();
        }
        /// <summary>
        /// Инициализация разных стаканов для тестирования.
        /// </summary>
        /// <returns>Массив разных типов стакана.</returns>
        static object[] GlassesCases()
        {
            var height         = new BorderConditions <double>(_min, _min, _max);
            var diameterBottom = new BorderConditions <double>(_min / 2,
                                                               _min / 2, _max / 2);
            var angleHeight = new BorderConditions <double>(_minAngle,
                                                            _minAngle, _maxAngle);
            var depthSideForFacetedGlass = new BorderConditions <double>(
                _minDepthForFacetedGlass, _minDepthForFacetedGlass,
                _maxDepthSide);
            var depthBottom = new BorderConditions <double>(
                _minDepthForFacetedGlass, _minDepthForFacetedGlass,
                _maxDepthBottom);
            var countFaceted = new BorderConditions <int>(
                _minCountFaceted, _minCountFaceted, _maxCountFaceted);

            var facetedGlass = new FacetedGlass(height, diameterBottom,
                                                angleHeight, depthSideForFacetedGlass, depthBottom,
                                                countFaceted);

            var cleanGlass = new CleanGlass(diameterBottom, height);

            countFaceted = new BorderConditions <int>(_minCountStrips,
                                                      _minCountStrips, _maxCountStrips);
            var crimpGlass = new CrimpGlass(height,
                                            diameterBottom, countFaceted);

            var glasses = new object[] {
                cleanGlass,
                facetedGlass,
                crimpGlass
            };

            return(glasses);
        }
        public void Setup()
        {
            var height         = new BorderConditions <double>(_min, _min, _max);
            var diameterBottom = new BorderConditions <double>(_min / 2,
                                                               _min / 2, _max / 2);

            _cleanGlass = new CleanGlass(diameterBottom, height);
        }
Esempio n. 4
0
 public void NegativeBorderConditionsConstructorTest(double min,
                                                     double value, double max)
 {
     Assert.Throws <ArgumentException>(() =>
     {
         var parameter = new BorderConditions(min, value, max);
     });
 }
        public void PositiveBorderConditionsConstructorTest(double min,
                                                            double value, double max)
        {
            var parameter = new BorderConditions <double>(min, value, max);

            Assert.That(min, Is.EqualTo(parameter.Min));
            Assert.That(value, Is.EqualTo(parameter.Value));
            Assert.That(max, Is.EqualTo(parameter.Max));
        }
        public void Setup()
        {
            var height         = new BorderConditions <double>(_min, _min, _max);
            var diameterBottom = new BorderConditions <double>(_min / 2,
                                                               _min / 2, _max / 2);
            var countFaceted = new BorderConditions <int>(_minCountFaceted,
                                                          _minCountFaceted, _maxCountFaceted);

            _crimpGlass = new CrimpGlass(height, diameterBottom,
                                         countFaceted);
        }
Esempio n. 7
0
        public void PositiveBorderConditionsConstructorTest(double min,
                                                            double value, double max)
        {
            var parameter = new BorderConditions(min, value, max);

            Assert.Multiple(() =>
            {
                Assert.AreEqual(min, parameter.Min);
                Assert.AreEqual(value, parameter.Value);
                Assert.AreEqual(max, parameter.Max);
            });
        }
            /// <summary>
            /// Установление параметров гладкого стакана.
            /// </summary>
            /// <param name="diameterBottom">Диаметр дна стакана.</param>
            /// <param name="height">Высота стакана.</param>
            public CleanGlass(BorderConditions <double> diameterBottom,
                              BorderConditions <double> height)
            {
                //Фиксированные параметры - angle height,
                //  count faceted, height faceted.
                //Зависимые автовычисляемые параметры - depth bottom,
                //  depth side.
                //Задаваемые параметры - height, diameter bottom.
                _dependencies = new DependenciesParams(false, false,
                                                       true, true, true, true, true);

                this._height         = height;
                this._diameterBottom = diameterBottom;
                _isValidParams.Add(_labelDiameterBottom, true);
                _isValidParams.Add(_labelHeight, true);
            }
        public void Setup()
        {
            var height         = new BorderConditions <double>(_min, _min, _max);
            var diameterBottom = new BorderConditions <double>(_min / 2,
                                                               _min / 2, _max / 2);
            var angleHeight = new BorderConditions <double>(_minAngle,
                                                            _minAngle, _maxAngle);
            var depthSide = new BorderConditions <double>(_minDepth,
                                                          _minDepth, _maxDepthSide);
            var depthBottom = new BorderConditions <double>(_minDepth,
                                                            _minDepth, _maxDepthBottom);
            var countFaceted = new BorderConditions <int>(
                _minCountFaceted, _minCountFaceted, _maxCountFaceted);

            _facetedGlass = new FacetedGlass(height, diameterBottom,
                                             angleHeight, depthSide, depthBottom, countFaceted);
        }
            /// <summary>
            /// Устанавливает задаваемые параметры для гофрированного стакана.
            /// </summary>
            /// <param name="height">Высота стакана.</param>
            /// <param name="diameterBottom">Диаметр дна стакана.</param>
            /// <param name="countFaceted">Количество граней стакана.</param>
            public CrimpGlass(BorderConditions <double> height,
                              BorderConditions <double> diameterBottom,
                              BorderConditions <int> countFaceted)
                : base(height, diameterBottom, null, null, null,
                       countFaceted)
            {
                //Зависимые автовычисляемые параметры - height faceted.
                //Фиксированные параметры - depth side, depth bottom,
                //  angle height.
                //Задаваемые параметры - height, diameter bottom,
                //  count faceted.
                _dependencies = new DependenciesParams(false, false,
                                                       true, true, true, true, false);

                this._angleHeight = new BorderConditions <double>(5, 5, 5);
                this._depthSide   = new BorderConditions <double>(3, 3, 3);
                this._depthBottom = new BorderConditions <double>(4, 4, 4);
            }
Esempio n. 11
0
        /// <summary>
        /// Создать экземпляр класса PhotoFrameTemplate.
        /// </summary>
        /// <returns>Возвращает экземпляр класса PhotoFrameTemplate.</returns>
        public static PhotoFrameTemplate GeneratePhotoFrameTemplate()
        {
            var outerWidth = new BorderConditions(_minForLengthAndWidth,
                                                  _max, _max);
            var outerHeight = new BorderConditions(_minHeight,
                                                   _value, _minForLengthAndWidth);
            var outerLength = new BorderConditions(_minForLengthAndWidth,
                                                   _max, _max);
            var innerHeight = new BorderConditions(_minHeight,
                                                   _value, _minForLengthAndWidth);
            var interval = new BorderConditions(_minHeight,
                                                _value, _maxInterval);

            return(new PhotoFrameTemplate(outerWidth,
                                          outerHeight,
                                          outerLength,
                                          innerHeight,
                                          interval));
        }
        /// <summary>
        /// Инициализация параметров разных типов стакана.
        /// </summary>
        public Glasses()
        {
            var height         = new BorderConditions <double>(_min, _max, _max);
            var diameterBottom = new BorderConditions <double>(_min / 2,
                                                               _max / 2, _max / 2);
            var angleHeight = new BorderConditions <double>(_minAngle,
                                                            _maxAngle, _maxAngle);
            var depthSideForFacetedGlass = new BorderConditions <double>(
                _minDepthForFacetedGlass, _maxDepthSide,
                _maxDepthSide);
            var depthBottom = new BorderConditions <double>(
                _minDepthForFacetedGlass, _maxDepthBottom,
                _maxDepthBottom);
            var countFaceted = new BorderConditions <int>(
                _minCountFaceted, _maxCountFaceted, _maxCountFaceted);

            var facetedGlass = new FacetedGlass(height, diameterBottom,
                                                angleHeight, depthSideForFacetedGlass, depthBottom,
                                                countFaceted);

            var builderCleanGlass   = new BuilderCleanGlass();
            var builderFacetedGlass = new BuilderFacetedGlass();
            var builderCrimpGlass   = new BuilderCrimpGlass();

            Add(new GlassViewModel(facetedGlass,
                                   builderFacetedGlass, "Гранёный"));

            var cleanGlass = new CleanGlass(diameterBottom, height);

            countFaceted = new BorderConditions <int>(_minCountStrips,
                                                      _maxCountStrips, _maxCountStrips);
            var crimpGlass = new CrimpGlass(height,
                                            diameterBottom, countFaceted);

            Add(new GlassViewModel(cleanGlass,
                                   builderCleanGlass, "Гладкий"));
            Add(new GlassViewModel(crimpGlass,
                                   builderCrimpGlass, "Гофрированный"));
        }
Esempio n. 13
0
            /// <summary>
            /// Устанавливает задаваемые параметры для граненого стакана.
            /// </summary>
            /// <param name="height">Высота стакана.</param>
            /// <param name="diameterBottom">Диаметр дна стакана.</param>
            /// <param name="angleHeight">Угол наклона высоты стакана.</param>
            /// <param name="depthSide">Толщина стенки стакана.</param>
            /// <param name="depthBottom">Толщина дна стакана.</param>
            /// <param name="countFaceted">Количество граней стакана.</param>
            public FacetedGlass(BorderConditions<double> height,
                BorderConditions<double> diameterBottom,
                BorderConditions<double> angleHeight,
                BorderConditions<double> depthSide,
                BorderConditions<double> depthBottom,
                BorderConditions<int> countFaceted)
                : base(diameterBottom, height)
            {
                //Зависимые автовычисляемые параметры - height faceted.
                //Задаваемые параметры - height, diameter bottom,
                //  angle height, count faceted, depth side, depth bottom.
                _dependencies = new DependenciesParams(false, false,
                    false, false, false, true, false);

                _angleHeight = angleHeight;
                _depthSide = depthSide;
                _depthBottom = depthBottom;
                _countFaceted = countFaceted;

                _isValidParams.Add(_labelAngleHeight, true);
                _isValidParams.Add(_labelCountFaceted, true);
                _isValidParams.Add(_labelDepthSide, true);
                _isValidParams.Add(_labelDepthBottom, true);
            }
 public void Setup()
 {
     _parameter = new BorderConditions <double>(_min, _value, _max);
 }