Article AndreClaude Gendron · Sep 19, 2017 1m read

It is with great pleasure that the CIUSSS de l'Estrie - CHUS is sharing the mocking framework it developed and presented at the InterSystems Summit 2017.  I will update this post with more detailed instructions in the next few weeks but I wanted to share the code and presentation quickly : 

https://gitlab.com/ciussse-drit-srd-public/Mocking-Framework

I hope you'll find this useful for your unit testing. We are using this extensively for the last 2 years and it really works well! The repo is public, feel free to submit enhancements!

Do not forget to enable the %UnitTest in your SMP. Instruct

14
1 2214
Question AndreClaude Gendron · Apr 19, 2016

We are trying to create a simple class extending %RegisteredObject that could be used as a singleton. However we are not able to store it in a global to later be retrieved (by the same process but elsewhere in the code).

I resumed my issue in this small code sample : 

ClassMethod RunMe()
{
   // Create a simple %RegisteredObject
   set obj = ##class(%ZEN.proxyObject).%New()
   set obj.MyProp = 22
   do ##class(%SYSTEM.OBJ).Dump(obj)
   
   // Store it in a global
   set ^MyGlobalName = obj
   write "Stored : " _ obj,!!
      
   // Retrieve it from the global
   #Dim obj2 As %ZEN.proxyObject = ^MyGlobalNam

8
0 1076