You can't do it that way. You can use case but only on one side of the equals. For example:
CASE A.ID WHEN 7 THEN A.name ELSE A.surname END = B.name
You might be able to put the case on both sides of the = sign (2 cases)
Not sure if this works, if it doesn't you'll probably need two joins
CASE A.ID WHEN 7 THEN A.name ELSE A.Surname END = CASE A.ID WHEN 7 THEN B.name ELSE B.surname END