public void TestGetVariableValue() { DataStorer dataStorer = new DataStorer(); Assert.IsNotNull(dataStorer, "Constructor of type, DataStorer failed to create instance."); Type type = dataStorer.GetType(); MethodInfo methodInfo = type.GetMethod("GetVariableValue", BindingFlags.NonPublic | BindingFlags.Static); Assert.IsNotNull(methodInfo, "GetMethod method returned unexpected value."); WrappedSimulator simulator = new WrappedSimulator(Util.GetDMDirs()); string name = "Value"; string entityPath = "Variable:/:V1:Value"; EcellValue value = (EcellValue)methodInfo.Invoke(dataStorer, new object[] { simulator, name, entityPath }); Assert.IsNotNull(methodInfo, "GetMethod method returned unexpected value."); Assert.AreEqual(0.0, (double)value, "GetValueFromDMM method returned unexpected result."); name = "Fixed"; value = (EcellValue)methodInfo.Invoke(dataStorer, new object[] { simulator, name, entityPath }); Assert.IsNotNull(methodInfo, "GetMethod method returned unexpected value."); Assert.AreEqual(0.0, (double)value, "GetValueFromDMM method returned unexpected result."); }
public void TestDataStored() { DataStorer dataStorer = new DataStorer(); Assert.IsNotNull(dataStorer, "Constructor of type, DataStorer failed to create instance."); Type type = dataStorer.GetType(); MethodInfo methodInfo = type.GetMethod("DataStored", BindingFlags.NonPublic | BindingFlags.Static); Assert.IsNotNull(methodInfo, "GetMethod method returned unexpected value."); WrappedSimulator simulator = new WrappedSimulator(Util.GetDMDirs()); DMDescriptorKeeper dmm = _env.DMDescriptorKeeper; EcellObject eo = EcellObject.CreateObject("Model", "/", EcellObject.SYSTEM, EcellObject.SYSTEM, new List<EcellData>()); Dictionary<string, double> initialCondition = new Dictionary<string, double>(); methodInfo.Invoke(dataStorer, new object[] { simulator, dmm, eo, initialCondition }); }
public void TestGetValueFromDMM() { DataStorer dataStorer = new DataStorer(); Assert.IsNotNull(dataStorer, "Constructor of type, DataStorer failed to create instance."); Type type = dataStorer.GetType(); MethodInfo methodInfo = type.GetMethod("GetValueFromDMM", BindingFlags.NonPublic | BindingFlags.Static); Assert.IsNotNull(methodInfo, "GetMethod method returned unexpected value."); DMDescriptorKeeper dmm = _env.DMDescriptorKeeper; string className = "ExpressionFluxProcess"; string name = "Expression"; EcellValue value = (EcellValue)methodInfo.Invoke(dataStorer, new object[] { dmm, Constants.xpathProcess, className, name }); Assert.IsNotNull(value, "GetValueFromDM method returned unexpected value."); Assert.IsTrue(value.IsString, "IsString is unexpected value."); Assert.AreEqual("", (string)value, "GetValueFromDMM method returned unexpected result."); name = "newValue"; value = (EcellValue)methodInfo.Invoke(dataStorer, new object[] { dmm, Constants.xpathProcess, className, name }); Assert.IsNotNull(value, "GetValueFromDM method returned unexpected value."); Assert.IsTrue(value.IsDouble, "IsString is unexpected value."); Assert.AreEqual(0.0, (double)value, "GetValueFromDMM method returned unexpected result."); className = "Hoge"; value = (EcellValue)methodInfo.Invoke(dataStorer, new object[] { dmm, Constants.xpathProcess, className, name }); Assert.IsNotNull(value, "GetValueFromDM method returned unexpected value."); Assert.IsTrue(value.IsString, "IsString is unexpected value."); Assert.AreEqual("", (string)value, "GetValueFromDMM method returned unexpected result."); }