public void StructTest() { var json = "{\"Name\":\"string\",\"Data\":1}"; var item = new testStruct() { Name = "string", Data = 1 }; var result = JsonConverter.SerializeObject(item); Assert.AreEqual(json, result); }
public void IntendedStructTest() { var json = IntendedStructResult; var item = new testStruct() { Name = "string", Data = 1 }; var result = JsonConverter.SerializeObject(item, Formatting.Indented); Assert.AreEqual(json, result); }
public void ShouldAssignStructOfBaseTypesByName() { var structInstance = new testStruct { x = 1, y = 2 }; Dictionary <string, object> inst = intStruct.AssignValuesFromObject(structInstance) as Dictionary <string, object>; Assert.AreEqual(1, inst["x"]); Assert.AreEqual(2, inst["y"]); }
public void ShouldAssignStructToNativeStruct() { var structInstance = new testStruct { x = 1, y = 2 }; Dictionary <string, object> inst = intStruct.AssignValuesFromObject(structInstance) as Dictionary <string, object>; testStruct nativeStruct = (testStruct)intStruct.AssignValuesToNativeType(inst, typeof(testStruct)); Assert.AreEqual(1, nativeStruct.x); Assert.AreEqual(2, nativeStruct.y); }
public static testStruct Spline(Quaternion q1, Quaternion q2, Quaternion q3, Quaternion q4, float t) { float section = Mathf.Floor(4.0f * t); float alongLine = 4.0f * t - section; if (section == 0) { testStruct d = new testStruct(); //Prova med q4 som start (loopinterpolation) typ d.quat = SplineSegment(q4, q1, q2, q3, alongLine); d.alongLine = alongLine; return(d); } else if (section == 1) { testStruct d = new testStruct(); d.quat = SplineSegment(q1, q2, q3, q4, alongLine); d.alongLine = alongLine; return(d); } else if (section == 2) { testStruct d = new testStruct(); d.quat = SplineSegment(q2, q3, q4, q1, alongLine); d.alongLine = alongLine; return(d); } else if (section == 3) { testStruct d = new testStruct(); d.quat = SplineSegment(q3, q4, q1, q2, alongLine); d.alongLine = alongLine; return(d); } testStruct f = new testStruct(); f.quat = new Quaternion(-1, -1, -1, -1); f.alongLine = 0; return(f); }
public object test(object a0, ref char a1, long a2, UIntPtr a3, ref UIntPtr a4, testStruct a5, ref testStruct a6, ref AOP a7, DateTime a8, ref DateTime a9) { return(Do(this, MethodBase.GetCurrentMethod(), new MList() { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9 })); /*0000 : ldarg.0 (2) * 0001 : ldarg.0 (2) * 0002 : call System.Reflection.MethodBase System.Reflection.MethodBase::GetCurrentMethod() (40|145|0|0|10) 167772305 * 0007 : newobj instance void MList::.ctor() (115|88|0|0|6) 100663384 * 0012 : stloc.0 (10) * 0013 : ldloc.0 (6) * 0014 : ldarg.1 (3) * 0015 : callvirt instance System.Void MList::Add() (111|91|0|0|6) 100663387 * 0020 : ldloc.0 (6) * 0021 : ldarg.2 (4) * 0022 : callvirt instance System.Void MList::Add() (111|91|0|0|6) 100663387 * 0027 : ldloc.0 (6) * 0028 : call instance System.Object testType::Do() (40|96|0|0|6) 100663392 * 0033 : ret (42) */ }
/// ////////////////////////////// SplineMoreThanFivePoints public static testStruct SplineMoreThanFivePoints(List <Quaternion> p_qList, float t) { int t_listSize = p_qList.Count; int section = (int)Mathf.Floor((t_listSize - 1) * t); float alongLine = (t_listSize - 1) * t - section; if (section == 0) { testStruct d = new testStruct(); d.quat = SplineSegment(p_qList[section + 1], p_qList[section], p_qList[section + 1], p_qList[section + 2], alongLine); d.alongLine = alongLine; d.m_section = section; return(d); } else if (section == t_listSize - 2 && section > 0) { testStruct d = new testStruct(); d.quat = SplineSegment(p_qList[section - 1], p_qList[section], p_qList[section + 1], p_qList[section], alongLine); d.alongLine = alongLine; d.m_section = section; return(d); } else if (section >= 1 && section < t_listSize - 2) { testStruct d = new testStruct(); d.quat = SplineSegment(p_qList[section - 1], p_qList[section], p_qList[section + 1], p_qList[section + 2], alongLine); d.alongLine = alongLine; d.m_section = section; return(d); } testStruct f = new testStruct(); f.quat = new Quaternion(-1, -1, -1, -1); f.alongLine = 0; f.m_section = section; return(f); }
/// //////////////////////////////// public static testStruct SplineForceShortWay(Quaternion q1, Quaternion q2, Quaternion q3, Quaternion q4, float t) { float section = Mathf.Floor(4.0f * t); float alongLine = 4.0f * t - section; if (section == 0) { testStruct d = new testStruct(); d.quat = SplineSegmentForceShortWay(q4, q1, q2, q3, alongLine); d.alongLine = alongLine; return(d); } else if (section == 1) { testStruct d = new testStruct(); d.quat = SplineSegmentForceShortWay(q1, q2, q3, q4, alongLine); d.alongLine = alongLine; return(d); } else if (section == 2) { testStruct d = new testStruct(); d.quat = SplineSegmentForceShortWay(q2, q3, q4, q1, alongLine); d.alongLine = alongLine; return(d); } else if (section == 3) { testStruct d = new testStruct(); d.quat = SplineSegmentForceShortWay(q3, q4, q1, q2, alongLine); d.alongLine = alongLine; return(d); } testStruct f = new testStruct(); f.quat = new Quaternion(-1, -1, -1, -1); f.alongLine = 0; return(f); }
public void ShouldAssignStructToNativeStruct() { var structInstance = new testStruct { x = 1, y = 2 }; Dictionary<string, object> inst = intStruct.AssignValuesFromObject(structInstance) as Dictionary<string, object>; testStruct nativeStruct = (testStruct)intStruct.AssignValuesToNativeType(inst, typeof(testStruct)); Assert.AreEqual(1, nativeStruct.x); Assert.AreEqual(2, nativeStruct.y); }
public void ShouldAssignStructOfBaseTypesByName() { var structInstance = new testStruct{ x = 1, y = 2 }; Dictionary<string, object> inst = intStruct.AssignValuesFromObject(structInstance) as Dictionary<string, object>; Assert.AreEqual(1, inst["x"]); Assert.AreEqual(2, inst["y"]); }