Ejemplo n.º 1
0
        public void TestCopy()
        {
            EcellObservedData data = new EcellObservedData();
            Assert.IsNotNull(data, "Constructor of type, EcellObservedData failed to create instance.");

            EcellObservedData newData = data.Copy();
            Assert.IsNotNull(newData, "Constructor of type, EcellObservedData failed to create instance.");
            Assert.AreEqual("", newData.Key, "Key is unexpected value.");
            Assert.AreEqual(100.0, newData.Max, "Max is unexpected value.");
            Assert.AreEqual(0, newData.Min, "Min is unexpected value.");
            Assert.AreEqual(100.0, newData.Differ, "Differ is unexpected value.");
            Assert.AreEqual(0.5, newData.Rate, "Rate is unexpected value.");
            Assert.AreEqual("Ecell.Objects.EcellObservedData", newData.GetType().ToString(), "GetType method returned unexpected value.");
            Assert.IsNotNull(newData.ToString(), "ToString method returned unexpected value.");

            data = new EcellObservedData("Variable:/S0:Value:MolarConc", 0.75, 0.25, 0.5, 0.5);
            Assert.IsNotNull(data, "Constructor of type, EcellObservedData failed to create instance.");

            newData = data.Copy();
            Assert.IsNotNull(newData, "Constructor of type, EcellObservedData failed to create instance.");
            Assert.AreEqual("Variable:/S0:Value:MolarConc", newData.Key, "Key is unexpected value.");
            Assert.AreEqual(0.75d, newData.Max, "Max is unexpected value.");
            Assert.AreEqual(0.25d, newData.Min, "Min is unexpected value.");
            Assert.AreEqual(0.5d, newData.Differ, "Differ is unexpected value.");
            Assert.AreEqual(0.5d, newData.Rate, "Rate is unexpected value.");
            Assert.AreEqual("Ecell.Objects.EcellObservedData", newData.GetType().ToString(), "GetType method returned unexpected value.");
            Assert.IsNotNull(newData.ToString(), "ToString method returned unexpected value.");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Set the observed data.
        /// </summary>
        /// <param name="data">the set observed data.</param>
        public void SetObservedData(EcellObservedData data)
        {
            foreach (DataGridViewRow r1 in bifurcationObservedDataGrid.Rows)
            {
                string fullPN = r1.Cells[observedFullPNColumn.Index].Value.ToString();
                if (fullPN.Equals(data.Key))
                {
                    // max
                    int index = dataGridViewTextBoxColumn6.Index;
                    r1.Cells[index].Value = data.Max;

                    // min
                    index = dataGridViewTextBoxColumn7.Index;
                    r1.Cells[index].Value = data.Min;

                    // differ
                    index = dataGridViewTextBoxColumn8.Index;
                    r1.Cells[index].Value = data.Differ;

                    // rate
                    index = dataGridViewTextBoxColumn9.Index;
                    r1.Cells[index].Value = data.Rate;

                    r1.Tag = data.Copy();
                    return;
                }
            }
            DataGridViewRow r = new DataGridViewRow();
            DataGridViewTextBoxCell c1 = new DataGridViewTextBoxCell();
            c1.Value = data.Key;
            r.Cells.Add(c1);

            DataGridViewTextBoxCell c2 = new DataGridViewTextBoxCell();
            c2.Value = data.Max;
            r.Cells.Add(c2);

            DataGridViewTextBoxCell c3 = new DataGridViewTextBoxCell();
            c3.Value = data.Min;
            r.Cells.Add(c3);

            DataGridViewTextBoxCell c4 = new DataGridViewTextBoxCell();
            c4.Value = data.Differ;
            r.Cells.Add(c4);

            DataGridViewTextBoxCell c5 = new DataGridViewTextBoxCell();
            c5.Value = data.Rate;
            r.Cells.Add(c5);

            r.Tag = data.Copy();
            bifurcationObservedDataGrid.Rows.Add(r);
        }