Ignore:
Timestamp:
Jun 25, 2012, 8:54:59 PM (12 years ago)
Author:
Sam Habiel
Message:

refactored BSDX26; still working on BSDX08

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Scheduling/trunk/m/BSDXUT1.m

    r1455 r1460  
    1 BSDXUT1 ; VEN/SMH - Unit Tests for Scheduling GUI - cont. ; 6/22/12 1:44pm
     1BSDXUT1 ; VEN/SMH - Unit Tests for Scheduling GUI - cont. ; 6/25/12 4:13pm
    22        ;;1.7T1;BSDX;;Aug 31, 2011;Build 18
    33        ;
     
    8686        W "Last line should say 0",!
    8787        QUIT
     88        ;
     89UT26    ; Unit Tests - BSDX26
     90        ;
     91        ; Test 1: Make sure this damn thing works
     92        ; Set-up - Create Clinics
     93        N RESNAM S RESNAM="UTCLINIC"
     94        N HLRESIENS ; holds output of UTCR^BSDXUT - HL IEN^Resource IEN
     95        D
     96        . N $ET S $ET="D ^%ZTER B"
     97        . S HLRESIENS=$$UTCR^BSDXUT(RESNAM)
     98        . I HLRESIENS<0 S $EC=",U1," ; not supposed to happen - hard crash if so
     99        ;
     100        N HLIEN,RESIEN
     101        S HLIEN=$P(HLRESIENS,U)
     102        S RESIEN=$P(HLRESIENS,U,2)
     103        ;
     104        ; Get start and end times
     105        N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
     106        N APPTTIME S APPTTIME=$P(TIMES,U)
     107        N ENDTIME S ENDTIME=$P(TIMES,U,2)
     108        ;
     109        ; Make appt
     110        N ZZZ,DFN
     111        S DFN=3
     112        D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
     113        N APPID S APPID=+$P(^BSDXTMP($J,1),U)
     114        ;
     115        ; Now edit the note - basic test
     116        N %H S %H=$H
     117        N NOTE S NOTE="New Note "_%H
     118        D EDITAPT^BSDX26(.ZZZ,APPID,NOTE)
     119        I ^BSDXAPPT(APPID,1,1,0)'=NOTE W "ERROR 1",!
     120        I $P(^SC(HLIEN,"S",APPTTIME,1,1,0),U,4)'=NOTE W "Error in HL Section",!
     121        ;
     122        ; Test 2: Test Error -1
     123        ; -1 --> ApptID not a number
     124        N ZZZ
     125        N NOTE S NOTE="Nothing important"
     126        D EDITAPT^BSDX26(.ZZZ,"BLAHBLAH",NOTE)
     127        I +^BSDXTMP($J,1)'=-1 W "ERROR IN -1",!
     128        ;
     129        ; Test 3: Test Error -2
     130        ; -2 --> ApptID not in ^BSDXAPPT
     131        D EDITAPT^BSDX26(.ZZZ,298734322,NOTE)
     132        I +^BSDXTMP($J,1)'=-2 W "ERROR IN -2",!
     133        ;
     134        ; Test 4: M Error
     135        N BSDXDIE S BSDXDIE=1
     136        D EDITAPT^BSDX26(.ZZZ,188,NOTE)
     137        I +^BSDXTMP($J,1)'=-100 W "ERROR IN -100",!
     138        K BSDXDIE
     139        ; Test 5: Trestart -- retired in v1.7
     140        ;
     141        ; Test 6: UTs for an unlinked resource (not linked to PIMS)
     142        N RESNAM S RESNAM="UTCLINICUL" ; Unlinked Clinic
     143        N RESIEN
     144        D
     145        . N $ET S $ET="D ^%ZTER B"
     146        . S RESIEN=$$UTCRRES^BSDXUT(RESNAM)
     147        . I RESIEN<0 S $EC=",U1," ; not supposed to happen - hard crash if so
     148        ;
     149        ; Get start and end times
     150        N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
     151        N APPTTIME S APPTTIME=$P(TIMES,U)
     152        N ENDTIME S ENDTIME=$P(TIMES,U,2)
     153        ;
     154        N ZZZ,DFN
     155        S DFN=3
     156        D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
     157        N APPID S APPID=+$P(^BSDXTMP($J,1),U)
     158        ; Now edit the note - basic test
     159        N %H S %H=$H
     160        N NOTE S NOTE="New Note "_%H
     161        D EDITAPT^BSDX26(.ZZZ,APPID,NOTE)
     162        I ^BSDXAPPT(APPID,1,1,0)'=NOTE W "ERROR 2",!
     163        ;
     164        ; Test 7: Simulated failure in BSDXAPI
     165        N RESNAM S RESNAM="UTCLINIC"
     166        N HLRESIENS ; holds output of UTCR^BSDXUT - HL IEN^Resource IEN
     167        D
     168        . N $ET S $ET="D ^%ZTER B"
     169        . S HLRESIENS=$$UTCR^BSDXUT(RESNAM)
     170        . I HLRESIENS<0 S $EC=",U1," ; not supposed to happen - hard crash if so
     171        ;
     172        N HLIEN,RESIEN
     173        S HLIEN=$P(HLRESIENS,U)
     174        S RESIEN=$P(HLRESIENS,U,2)
     175        ;
     176        ; Get start and end times
     177        N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
     178        N APPTTIME S APPTTIME=$P(TIMES,U)
     179        N ENDTIME S ENDTIME=$P(TIMES,U,2)
     180        ;
     181        ; Make appt
     182        N ZZZ,DFN
     183        S DFN=3
     184        N ORIGNOTE S ORIGNOTE="Sam's Note"
     185        D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,ORIGNOTE,1)
     186        N APPID S APPID=+$P(^BSDXTMP($J,1),U)
     187        ;
     188        ; Create the error condition
     189        N BSDXSIMERR1 S BSDXSIMERR1=1
     190        ;
     191        ; Try to edit the note. Should still be "Sam's Note"
     192        N %H S %H=$H
     193        N NOTE S NOTE="New Note "_%H
     194        D EDITAPT^BSDX26(.ZZZ,APPID,NOTE)
     195        I +^BSDXTMP($J,1)'=-4 W "Simulated error not triggered",!
     196        I ^BSDXAPPT(APPID,1,1,0)'=ORIGNOTE ZWRITE ^(*) W "ERROR 3",!
     197        I $P(^SC(HLIEN,"S",APPTTIME,1,1,0),U,4)'=ORIGNOTE W "ERROR 4",!
     198        QUIT
Note: See TracChangeset for help on using the changeset viewer.