Suppose I have a Javascript class defined this way:
class TmpTestResult {
constructor(id, title, testresult, tags, subsystem, info){
this.ID = id;
this.Title = title;
this.TestResult = testresult;
this.Tags = tags;
this.Subystem = subsystem;
this.Info = info;
}
How do I go about storing an array of TmpTestResults in Javascript?
(I'm so used to strongly typed c#, that I am at a loss as to how to do this.)
My sample data looks like this:
function GetFakeData() {
var fakeTestResultArray = {
"jsonData": "",
"listResults": [{
"MyViewName": "Test View",
"ID": "10233",
"Title": "Verify the Production data is working.",
"TestResult": "Pass",
"Tags": "ATAB, Production, MOCK",
"Subsystem": "TEST",
"Info": "OK : OK"
},
{
"MyViewName": "Test View",
"ID": "54875",
"Title": "Verify the Production data is working one more time.",
"TestResult": "Pass",
"Tags": "ATAB, Production, MOCK",
"Subsystem": "TEST",
"Info": "OK : OK"
},
{
"MyViewName": "Test View",
"ID": "87541",
"Title": "Verify the Production data is working for a third.",
"TestResult": "Pass",
"Tags": "ATAB, Production, MOCK",
"Subsystem": "TEST",
"Info": "OK : OK"
}],
"MyViewName": "TEST Tests",
"ErrorInfo": "none",
"Count" : 0
}
class) start with an upper-case letter and use CamelCase. Some people write symbolic constants (like the number of milliseconds in a day) in ALL_CAPS_WITH_UNDERSCORES. Others don't. Essentially, like C# except for a lower initial letter (except for constructor function/class names).