示例#1
0
        public void CreateDetail(bool expected, params double[] parameters)
        {
            var figureParameters = new List <double>();

            for (int i = 0, length = parameters.Length; i < length; i++)
            {
                figureParameters.Add(parameters[i]);
            }

            var figureParametersValidator = new FigureParametersValidator(figureParameters);

            figureParametersValidator.Validate();

            var app = new KompasApplication
            {
                Parameters = figureParameters
            };

            app.CreateDocument3D();

            var manager = new BuildManager(app);
            var result  = manager.CreateDetail();

            Assert.AreEqual(result, expected);
        }
示例#2
0
        /// <summary>
        /// Create Kompas application for tests
        /// </summary>
        /// <returns>Kompas application</returns>
        public KompasApplication CreateKompasApplication()
        {
            var parameters = new List <double>()
            {
                85, 75, 125, 375, 50, 60
            };
            var app = new KompasApplication();

            app.Parameters = parameters;
            app.CreateDocument3D();

            return(app);
        }
示例#3
0
        /// <summary>
        /// Validate user input parameters and build figure after that
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RunButton_Click(object sender, EventArgs e)
        {
            var errorCatcher = new ErrorCatcher();

            if (_kompasApp == null)
            {
                MessageBox.Show("Load KOMPAS 3D first.", "Information",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                return;
            }

            if (!SetFigureParameters())
            {
                return;
            }

            _kompasApp.Parameters = _figureParameters;

            // Create 3D document
            if (!_kompasApp.CreateDocument3D())
            {
                return;
            }

            // Create build manager
            BuildManager _buildManager = new BuildManager(_kompasApp);

            if (_buildManager == null)
            {
                errorCatcher.CatchError(ErrorCodes.ManagerCreatingError);
                return;
            }
            if (_buildManager.LastErrorCode != ErrorCodes.OK)
            {
                errorCatcher.CatchError(_buildManager.LastErrorCode);
                return;
            }

            _buildManager.CreateDetail();

            if (_buildManager.LastErrorCode != ErrorCodes.OK)
            {
                errorCatcher.CatchError(_buildManager.LastErrorCode);
            }
            else
            {
                errorCatcher.CatchSuccess();
            }
        }
示例#4
0
        public void TestDestructKompasApplication()
        {
            var parameters = new List <double>()
            {
                85, 75, 125, 375, 50, 60
            };
            var app = new KompasApplication();

            app.Parameters = parameters;

            app.CreateDocument3D();

            app.DestructApp();
        }
        public void TestDestructKompasApplication()
        {
            var parameters = new List <double>()
            {
                27, 5, 25, 64, 10, 5
            };
            var app = new KompasApplication
            {
                Parameters = parameters
            };

            app.CreateDocument3D();

            app.DestructApp();
        }
        /// <summary>
        /// Создать Kompas application для теста
        /// </summary>
        /// <returns>Kompas application</returns>
        public KompasApplication CreateKompasApplication()
        {
            var parameters = new List <double>()
            {
                27, 5, 25, 64, 10, 5
            };
            var app = new KompasApplication
            {
                Parameters = parameters
            };

            app.CreateDocument3D();

            return(app);
        }
示例#7
0
        public void TestConstructKompasApplication(ErrorCodes res, params double[] parameters)
        {
            var figureParameters = new List <double>();

            for (int i = 0, length = parameters.Length; i < length; i++)
            {
                figureParameters.Add(parameters[i]);
            }

            var app = new KompasApplication();

            app.Parameters = figureParameters;
            Assert.AreEqual(app.LastErrorCode, res);

            Assert.IsTrue(app.CreateDocument3D());
        }