コード例 #1
0
ファイル: TestEcellData.cs プロジェクト: ecell/ecell3-ide
        public void TestAccessors()
        {
            string name = "TestData";
            EcellValue value = new EcellValue(0.001);
            string entityPath = "Variable:/:V0:TestData";

            EcellData data = new EcellData();
            data.Name = name;
            data.Value = value;
            data.EntityPath = entityPath;
            Assert.IsNotNull(data, "Constructor of type, EcellData failed to create instance.");
            Assert.AreEqual(name, data.Name, "Name is not expected value.");
            Assert.AreEqual(entityPath, data.EntityPath, "EntityPath is not expected value.");
            Assert.AreEqual(value, data.Value, "Value is not expected value.");
            Assert.IsTrue(data.Gettable, "Gettable is not expected value.");
            Assert.IsTrue(data.Loadable, "Loadable is not expected value.");
            Assert.IsFalse(data.Logable, "Logable is not expected value.");
            Assert.IsFalse(data.Logged, "Logged is not expected value.");
            Assert.IsTrue(data.Saveable, "Saveable is not expected value.");
            Assert.IsTrue(data.Settable, "Settable is not expected value.");
            Assert.IsTrue(data.IsInitialized(), "IsInitialized is not expected value.");

            data.Settable = false;
            Assert.IsFalse(data.Settable, "Settable is not expected value.");
            Assert.IsFalse(data.IsInitialized(), "IsInitialized is not expected value.");

            data.Gettable = false;
            data.Loadable = false;
            data.Logable = false;
            data.Logged = false;
            data.Saveable = false;
            Assert.IsFalse(data.Gettable, "Gettable is not expected value.");
            Assert.IsFalse(data.Loadable, "Loadable is not expected value.");
            Assert.IsFalse(data.Logable, "Logable is not expected value.");
            Assert.IsFalse(data.Logged, "Logged is not expected value.");
            Assert.IsFalse(data.Saveable, "Saveable is not expected value.");

            data.Gettable = true;
            data.Loadable = true;
            data.Logable = true;
            data.Logged = true;
            data.Saveable = true;
            Assert.IsTrue(data.Gettable, "Gettable is not expected value.");
            Assert.IsTrue(data.Loadable, "Loadable is not expected value.");
            Assert.IsTrue(data.Logable, "Logable is not expected value.");
            Assert.IsTrue(data.Logged, "Logged is not expected value.");
            Assert.IsTrue(data.Saveable, "Saveable is not expected value.");
            Assert.IsFalse(data.Settable, "Settable is not expected value.");
            Assert.IsFalse(data.IsInitialized(), "IsInitialized is not expected value.");

            data.Settable = true;
            Assert.IsTrue(data.Settable, "Settable is not expected value.");
            Assert.IsTrue(data.IsInitialized(), "IsInitialized is not expected value.");
        }
コード例 #2
0
ファイル: TestEcellData.cs プロジェクト: ecell/ecell3-ide
        public void TestConstructorEcellDataNameValueEntityPath()
        {
            string name = null;
            EcellValue value = null;
            string entityPath = null;

            // null (uninitialized)
            EcellData data = new EcellData(name, value, entityPath);
            Assert.IsNotNull(data, "Constructor of type, EcellData failed to create instance.");
            Assert.IsNull(data.Name, "Name is not null.");
            Assert.IsNull(data.EntityPath, "EntityPath is not null.");
            Assert.IsNull(data.Value, "Value is not null.");
            Assert.IsTrue(data.Gettable, "Gettable is not expected value.");
            Assert.IsTrue(data.Loadable, "Loadable is not expected value.");
            Assert.IsFalse(data.Logable, "Logable is not expected value.");
            Assert.IsFalse(data.Logged, "Logged is not expected value.");
            Assert.IsTrue(data.Saveable, "Saveable is not expected value.");
            Assert.IsTrue(data.Settable, "Settable is not expected value.");
            Assert.IsFalse(data.IsInitialized(), "IsInitialized is not expected value.");

            name = "TestData";
            entityPath = "Variable:/:V0:TestData";

            // int
            value = new EcellValue(1);
            data = new EcellData(name, value, entityPath);
            Assert.IsNotNull(data, "Constructor of type, EcellData failed to create instance.");
            Assert.AreEqual(name, data.Name, "Name is not expected value.");
            Assert.AreEqual(entityPath, data.EntityPath, "EntityPath is not expected value.");
            Assert.AreEqual(value, data.Value, "Value is not expected value.");
            Assert.IsTrue(data.Gettable, "Gettable is not expected value.");
            Assert.IsTrue(data.Loadable, "Loadable is not expected value.");
            Assert.IsFalse(data.Logable, "Logable is not expected value.");
            Assert.IsFalse(data.Logged, "Logged is not expected value.");
            Assert.IsTrue(data.Saveable, "Saveable is not expected value.");
            Assert.IsTrue(data.Settable, "Settable is not expected value.");
            Assert.IsTrue(data.IsInitialized(), "IsInitialized is not expected value.");

            // double
            value = new EcellValue(0.001);
            data = new EcellData(name, value, entityPath);
            Assert.IsNotNull(data, "Constructor of type, EcellData failed to create instance.");
            Assert.AreEqual(name, data.Name, "Name is not expected value.");
            Assert.AreEqual(entityPath, data.EntityPath, "EntityPath is not expected value.");
            Assert.AreEqual(value, data.Value, "Value is not expected value.");
            Assert.IsTrue(data.Gettable, "Gettable is not expected value.");
            Assert.IsTrue(data.Loadable, "Loadable is not expected value.");
            Assert.IsFalse(data.Logable, "Logable is not expected value.");
            Assert.IsFalse(data.Logged, "Logged is not expected value.");
            Assert.IsTrue(data.Saveable, "Saveable is not expected value.");
            Assert.IsTrue(data.Settable, "Settable is not expected value.");
            Assert.IsTrue(data.IsInitialized(), "IsInitialized is not expected value.");

            // string
            value = new EcellValue("test");
            data = new EcellData(name, value, entityPath);
            Assert.IsNotNull(data, "Constructor of type, EcellData failed to create instance.");
            Assert.AreEqual(name, data.Name, "Name is not expected value.");
            Assert.AreEqual(entityPath, data.EntityPath, "EntityPath is not expected value.");
            Assert.IsTrue(value.Equals(data.Value), "Value is not expected value.");
            Assert.IsTrue(data.Gettable, "Gettable is not expected value.");
            Assert.IsTrue(data.Loadable, "Loadable is not expected value.");
            Assert.IsFalse(data.Logable, "Logable is not expected value.");
            Assert.IsFalse(data.Logged, "Logged is not expected value.");
            Assert.IsTrue(data.Saveable, "Saveable is not expected value.");
            Assert.IsTrue(data.Settable, "Settable is not expected value.");
            Assert.IsFalse(data.IsInitialized(), "IsInitialized is not expected value.");

            // List
            List<EcellValue> list = new List<EcellValue>();
            value = new EcellValue(list);
            data = new EcellData(name, value, entityPath);
            Assert.IsNotNull(data, "Constructor of type, EcellData failed to create instance.");
            Assert.AreEqual(name, data.Name, "Name is not expected value.");
            Assert.AreEqual(entityPath, data.EntityPath, "EntityPath is not expected value.");
            Assert.IsTrue(value.Equals(data.Value), "Value is not expected value.");
            Assert.IsTrue(data.Gettable, "Gettable is not expected value.");
            Assert.IsTrue(data.Loadable, "Loadable is not expected value.");
            Assert.IsFalse(data.Logable, "Logable is not expected value.");
            Assert.IsFalse(data.Logged, "Logged is not expected value.");
            Assert.IsTrue(data.Saveable, "Saveable is not expected value.");
            Assert.IsTrue(data.Settable, "Settable is not expected value.");
            Assert.IsFalse(data.IsInitialized(), "IsInitialized is not expected value.");
        }
コード例 #3
0
ファイル: TestEcellData.cs プロジェクト: ecell/ecell3-ide
        public void TestIsInitialized()
        {
            bool expectedBoolean = false;
            bool resultBoolean = false;

            EcellData data = new EcellData();
            expectedBoolean = false;
            resultBoolean = data.IsInitialized();
            Assert.AreEqual(expectedBoolean, resultBoolean, "IsInitialized method returned unexpected result.");

            data = new EcellData("Value", new EcellValue(1), "Variable:/:Test:Value");
            expectedBoolean = true;
            resultBoolean = data.IsInitialized();
            Assert.AreEqual(expectedBoolean, resultBoolean, "IsInitialized method returned unexpected result.");

            data = new EcellData("Value", new EcellValue(0.1), "Variable:/:Test:Value");
            expectedBoolean = true;
            resultBoolean = data.IsInitialized();
            Assert.AreEqual(expectedBoolean, resultBoolean, "IsInitialized method returned unexpected result.");

            data = new EcellData("Value", new EcellValue("data"), "Variable:/:Test:Value");
            expectedBoolean = false;
            resultBoolean = data.IsInitialized();
            Assert.AreEqual(expectedBoolean, resultBoolean, "IsInitialized method returned unexpected result.");

            data = new EcellData("Value", new EcellValue(new List<EcellValue>()), "Variable:/:Test:Value");
            expectedBoolean = false;
            resultBoolean = data.IsInitialized();
            Assert.AreEqual(expectedBoolean, resultBoolean, "IsInitialized method returned unexpected result.");

            data.Settable = false;
            expectedBoolean = false;
            resultBoolean = data.IsInitialized();
            Assert.AreEqual(expectedBoolean, resultBoolean, "IsInitialized method returned unexpected result.");
        }
コード例 #4
0
ファイル: TestEcellData.cs プロジェクト: ecell/ecell3-ide
 public void TestConstructorEcellData()
 {
     EcellData data = new EcellData();
     Assert.IsNotNull(data, "Constructor of type, EcellData failed to create instance.");
     Assert.IsNull(data.Name, "Name is not null.");
     Assert.IsNull(data.EntityPath, "EntityPath is not null.");
     Assert.IsNull(data.Value, "Value is not null.");
     Assert.IsTrue(data.Gettable, "Gettable is not expected value.");
     Assert.IsTrue(data.Loadable, "Loadable is not expected value.");
     Assert.IsFalse(data.Logable, "Logable is not expected value.");
     Assert.IsFalse(data.Logged, "Logged is not expected value.");
     Assert.IsTrue(data.Saveable, "Saveable is not expected value.");
     Assert.IsTrue(data.Settable, "Settable is not expected value.");
     Assert.IsFalse(data.IsInitialized(), "IsInitialized is not expected value.");
 }