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 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); }
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); }
public bool PosTest13() { bool retVal = true; string ActualResult; object ObjA; TestLibrary.TestFramework.BeginScenario("PosTest13:Concat an object of number of less than 0"); try { ObjA = -123; ActualResult = string.Concat(ObjA); if (ActualResult != ObjA.ToString()) { TestLibrary.TestFramework.LogError("025", "Concat an object of number of less than 0 ExpectResult is equel" + ObjA.ToString() + ",ActualResult is (" + ActualResult + ")"); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("026", "Unexpected exception" + e); retVal = false; } return(retVal); }