示例#1
0
 /// <summary>
 /// Create the text with temporary ID.
 /// </summary>
 /// <param name="modelID">model ID of created object.</param>
 /// <returns></returns>
 private EcellObject CreateDefaultText(string modelID)
 {
     string nodeKey = GetTemporaryID(modelID, EcellObject.TEXT, "/");
     EcellText text = new EcellText(modelID, nodeKey, EcellObject.TEXT, EcellObject.TEXT, new List<EcellData>());
     return text;
 }
示例#2
0
        /// <summary>
        /// Returns the new "EcellObject" instance with initialized arguments.
        /// </summary>
        /// <param name="modelID">The model ID</param>
        /// <param name="key">The key</param>
        /// <param name="type">The type</param>
        /// <param name="classname">The class</param>
        /// <param name="data">The data</param>
        /// <returns>The new "EcellObject" instance</returns>
        public static EcellObject CreateObject(string modelID, string key,
            string type, string classname, List<EcellData> data)
        {
            //if (string.IsNullOrEmpty(modelID))
            //    throw new EcellException(string.Format(MessageResources.ErrInvalidParam, MODEL));
            if (Util.IsNGforType(type))
                throw new EcellException(string.Format(MessageResources.ErrInvalidParam, TYPE));

            EcellObject obj = null;
            if (type.Equals(MODEL))
                obj = new EcellModel(modelID, key, type, classname, data);
            else if (type.Equals(PROCESS))
                obj = new EcellProcess(modelID, key, type, classname, data);
            else if (type.Equals(VARIABLE))
                obj = new EcellVariable(modelID, key, type, classname, data);
            else if (type.Equals(SYSTEM))
                obj = new EcellSystem(modelID, key, type, classname, data);
            else if (type.Equals(TEXT))
                obj = new EcellText(modelID, key, type, classname, data);
            else if (type.Equals(STEPPER))
                obj = new EcellStepper(modelID, key, type, classname, data);
            else if (type.Equals(PROJECT))
                obj = new EcellProject(modelID, key, type, classname, data);
            return obj;
        }
示例#3
0
        public void TestGetImageIndex_EcellObject()
        {
            EcellObject obj = null;
            int expectedInt32 = -1;
            int resultInt32 = 0;
            resultInt32 = _unitUnderTest.GetImageIndex(obj);
            Assert.AreEqual(expectedInt32, resultInt32, "GetImageIndex method returned unexpected result.");

            obj = new EcellProject("", "", "", "", new List<EcellData>());
            expectedInt32 = 0;
            resultInt32 = 0;
            resultInt32 = _unitUnderTest.GetImageIndex(obj);
            Assert.AreEqual(expectedInt32, resultInt32, "GetImageIndex method returned unexpected result.");

            obj = new EcellModel("", "", "", "", new List<EcellData>());
            expectedInt32 = 1;
            resultInt32 = 0;
            resultInt32 = _unitUnderTest.GetImageIndex(obj);
            Assert.AreEqual(expectedInt32, resultInt32, "GetImageIndex method returned unexpected result.");

            obj = new EcellSystem("", "", "", "", new List<EcellData>());
            expectedInt32 = 2;
            resultInt32 = 0;
            resultInt32 = _unitUnderTest.GetImageIndex(obj);
            Assert.AreEqual(expectedInt32, resultInt32, "GetImageIndex method returned unexpected result.");

            obj = new EcellProcess("", "", "", "", new List<EcellData>());
            expectedInt32 = 3;
            resultInt32 = 0;
            resultInt32 = _unitUnderTest.GetImageIndex(obj);
            Assert.AreEqual(expectedInt32, resultInt32, "GetImageIndex method returned unexpected result.");

            obj = new EcellVariable("", "", "", "", new List<EcellData>());
            expectedInt32 = 4;
            resultInt32 = 0;
            resultInt32 = _unitUnderTest.GetImageIndex(obj);
            Assert.AreEqual(expectedInt32, resultInt32, "GetImageIndex method returned unexpected result.");

            obj = new EcellText("", "/:Text", "", "", new List<EcellData>());
            expectedInt32 = 10;
            resultInt32 = 0;
            resultInt32 = _unitUnderTest.GetImageIndex(obj);
            Assert.AreEqual(expectedInt32, resultInt32, "GetImageIndex method returned unexpected result.");

            obj = new EcellStepper("", "", "", "", new List<EcellData>());
            expectedInt32 = 11;
            resultInt32 = 0;
            resultInt32 = _unitUnderTest.GetImageIndex(obj);
            Assert.AreEqual(expectedInt32, resultInt32, "GetImageIndex method returned unexpected result.");

            obj.Layout.Figure = "System";
            expectedInt32 = 2;
            resultInt32 = 0;
            resultInt32 = _unitUnderTest.GetImageIndex(obj);
            Assert.AreEqual(expectedInt32, resultInt32, "GetImageIndex method returned unexpected result.");
        }
示例#4
0
        public void TestEcellText()
        {
            EcellText text = new EcellText("Model", "/:Text1", "Text", "", new List<EcellData>());

            Assert.AreEqual(StringAlignment.Near, text.Alignment, "Alignment is not expected value.");
            text.Alignment = StringAlignment.Center;
            Assert.AreEqual(StringAlignment.Center, text.Alignment, "Alignment is not expected value.");

            Assert.AreEqual("Text1", text.Comment, "Comment is not expected value.");
            text.Comment = "Test";
            Assert.AreEqual("Test", text.Comment, "Comment is not expected value.");
            text.RemoveEcellValue("Comment");
            Assert.AreEqual(null, text.Comment, "Comment is not expected value.");

            text.Comment = "Sample";
            text.Alignment = StringAlignment.Center;
            EcellText text2 = (EcellText)text.Clone();
            Assert.AreEqual(text.Comment, text2.Comment, "Comment is not expected value.");
            Assert.AreEqual(text.Alignment, text2.Alignment, "Comment is not expected value.");

            text.SetEcellValue(EcellText.ALIGN, new EcellValue(4));
            Assert.AreEqual(StringAlignment.Near, text.Alignment, "Alignment is not expected value.");
        }