public bool PosTest10() { bool retVal = true; string ActualResult; object ObjA; object ObjB; object ObjC; TestLibrary.TestFramework.BeginScenario("PosTest10:Concat two guids with a \n string in middle"); try { ObjA = new Guid(); ObjB = "\n"; ObjC = new Guid(); ActualResult = string.Concat(ObjA, ObjB, ObjC); if (ActualResult != ObjA.ToString() + ObjB.ToString() + ObjC.ToString()) { TestLibrary.TestFramework.LogError("019", "Concat two guids with a \n string in middle ExpectResult is equel" + ObjA.ToString() + ObjB.ToString() + ObjC.ToString() + ",ActualResult is (" + ActualResult + ")"); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("020", "Unexpected exception" + e); retVal = false; } return(retVal); }
public bool PosTest5() { bool retVal = true; string ActualResult; object ObjA; object ObjB; object ObjC; TestLibrary.TestFramework.BeginScenario("PosTest5:Concat three numbers of less than 0"); try { ObjA = -123; ObjB = -123; ObjC = -123; ActualResult = string.Concat(ObjA, ObjB, ObjC); if (ActualResult != ObjA.ToString() + ObjB.ToString() + ObjC.ToString()) { TestLibrary.TestFramework.LogError("009", "Concat three numbers of less than 0 ExpectResult is equel" + ObjA.ToString() + ObjB.ToString() + " ,ActualResult is (" + ActualResult + ")"); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("010", "Unexpected exception" + e); retVal = false; } return(retVal); }
public bool PosTest9() { bool retVal = true; string ActualResult; object ObjA; object ObjB; object ObjC; TestLibrary.TestFramework.BeginScenario("PosTest9: Concat int and special symbol and an object of Guid"); try { ObjA = 123; ObjB = "\n"; ObjC = new Guid(); ActualResult = string.Concat(ObjA, ObjB, ObjC); if (ActualResult != ObjA.ToString() + ObjB.ToString() + ObjC.ToString()) { TestLibrary.TestFramework.LogError("017", "Concat int and special symbol and an object of Guid ExpectResult is equel" + ObjA.ToString() + ObjB.ToString() + ObjC.ToString() + ",ActualResult is (" + ActualResult + ")"); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("018", "Unexpected exception" + e); retVal = false; } return(retVal); }
public bool PosTest4() { bool retVal = true; string ActualResult; object ObjA; object ObjB; object ObjC; TestLibrary.TestFramework.BeginScenario("PosTest4: Concat three special strings"); try { ObjA = new string('\t', 2); ObjB = "\n"; ObjC = "\t"; ActualResult = string.Concat(ObjA, ObjB, ObjC); if (ActualResult != ObjA.ToString() + ObjB.ToString() + ObjC.ToString()) { TestLibrary.TestFramework.LogError("007", "Concat three special strings ExpectResult is" + ObjB.ToString() + ObjA.ToString() + ObjC.ToString() + " ,ActualResult is (" + ActualResult + ")"); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("008", "Unexpected exception" + e); retVal = false; } return(retVal); }
public void DictTest() { ObjB b = new ObjB(); b.As.Add(new ObjA("A1", "B1")); b.As.Add(new ObjA("A2", "B2")); string json = Json.stringify(b); Console.WriteLine(json); // var res = Json.toDict(json); Console.WriteLine(json); }
public void JsonTest() { ObjB b = new ObjB(); b.As.Add(new ObjA("A1", "B1")); b.As.Add(new ObjA("A2", "B2")); string json = Json.stringify(b); Console.WriteLine(json); // var js = new JavaScriptSerializer(); js.RegisterConverters(new JavaScriptConverter[] { new JsonConverter(new Type[] { typeof(ObjA), typeof(ObjB) }) }); ObjB b2 = js.Deserialize<ObjB>(json); //b = Json.parse<ObjB>(json); Assert.AreEqual(b.As[0].A, b2.As[0].A); Assert.AreEqual(b.As[1].A, b2.As[1].A); }
static void Main(string[] args) { ObjA a = new ObjA(); a.Id = 123; a.OtherStuff = "other stuff A"; ObjB b = new ObjB(); b.Id = 456; b.OtherStuff = "other stuff B"; b.MyParent = a; a.MyChild = b; JsonSerializerSettings settings = new JsonSerializerSettings { ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, Formatting = Newtonsoft.Json.Formatting.Indented }; string json = JsonConvert.SerializeObject(a, settings); Console.WriteLine(json); }
private void CheckCollisions(double ElapsedTime, List <ICollidable> Objects) { QTree.Clear(); for (int i = 0; i < Objects.Count; i++) { QTree.Add(Objects[i]); } QTree.CheckCollisions(); PairList <ICollidable> Collisions = QTree.GetCollisions(); for (int i = 0; i < Collisions.Count; i++) { ObjA = Collisions.Get(i).Get(0); ObjB = Collisions.Get(i).Get(1); ObjA.Collide(ObjB); ObjB.Collide(ObjA); //Collisions.Get(i).Get(0).Collide(Collisions.Get(i).Get(1)); //Collisions.Get(i).Get(1).Collide(Collisions.Get(i).Get(0)); } }