Bug fixes and code completion tests

This pull request is in continuation with the previous one. It includes bug fixes and test cases for functionality implemented in: https://github.com/DynamoDS/Dynamo/pull/2503.

@monikaprabhu please review the test cases I have added to ```CodeCompletionTests.cs```
@Benglin please also take a look