I'm hustling around with selenium and having a little hard time with my Assert. I have something like this.
_request = new RestRequest($"applications", Method.GET);
var result = JsonConvert.DeserializeObject<AppRoot[]>(_restClient.Execute(_request).Content);
var org = result.FirstOrDefault(a => a.orgNr.ToString() == "1337");
Assert.IsTrue((org.applicationType == type && org == null) ? true : false, "Failed" + type);
Now if org.applicationType
match the type Assert is passing (true).
And if var org = null
, I want the Assert to return false, with the message - Failed type
But here the assert is looking for the variable and fails with the classic System.NullReferenceException : Object reference not set to an instance
Any ideas on how this can be handled?
Thanks in advance.