Expression cannot b...
 
Notifications
Clear all

[Solved] Expression cannot be assigned

2 Posts
1 Users
0 Likes
382 Views
Posts: 205
 CWL
Admin
Issue starter
(@cwl)
Member
Joined: 11 years ago

I am getting the error: Expression cannot be assigned - in the following code:

        if (ocp != null && ocp.Active__c = true){
            Assert.areEqual (true, resp.success);
        }
        else {
            Assert.areEqual(false, resp.success);
            Assert.areNotEqual('This is not Account 1.5', resp.message);
        }
 
Issue Tags
1 Reply
Posts: 205
 CWL
Admin
Issue starter
(@cwl)
Member
Joined: 11 years ago

Comparison operator is ==

= is assignment operator

Corrected code:

        if (ocp != null && ocp.Active__c == true){
            Assert.areEqual (true, resp.success);
        }
        else {
            Assert.areEqual(false, resp.success);
            Assert.areNotEqual('This is not Account 1.5', resp.message);
        }
Reply
Share: