Ignore:
Timestamp:
Jun 26, 2012, 8:01:30 PM (12 years ago)
Author:
Sam Habiel
Message:

Refactoring cont.
Many changes in BSDX08. Extensive changes in BSDX31. Creation of BSDXAPI1 as continuation of BSDXAPI.
BSDXUT1 now has UTs for BSDX31. Transactions now gone from BSDX08 and BSDX31.
BSDX08 needs more tests at failure points. BSDX31 still needs analysis for transaction failure and
code for rollback points, plus tests for that.

File:
1 edited

Legend:

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

    r1460 r1461  
    1 BSDXUT1 ; VEN/SMH - Unit Tests for Scheduling GUI - cont. ; 6/25/12 4:13pm
     1BSDXUT1 ; VEN/SMH - Unit Tests for Scheduling GUI - cont. ; 6/26/12 4:36pm
    22        ;;1.7T1;BSDX;;Aug 31, 2011;Build 18
    33        ;
     
    194194        D EDITAPT^BSDX26(.ZZZ,APPID,NOTE)
    195195        I +^BSDXTMP($J,1)'=-4 W "Simulated error not triggered",!
    196         I ^BSDXAPPT(APPID,1,1,0)'=ORIGNOTE ZWRITE ^(*) W "ERROR 3",!
     196        I ^BSDXAPPT(APPID,1,1,0)'=ORIGNOTE W "ERROR 3",!
    197197        I $P(^SC(HLIEN,"S",APPTTIME,1,1,0),U,4)'=ORIGNOTE W "ERROR 4",!
    198198        QUIT
     199        ;
     200UT31 ; Unit Tests for BSDX31
     201        ; Set-up - Create Clinics
     202        N RESNAM S RESNAM="UTCLINIC"
     203        N HLRESIENS ; holds output of UTCR^BSDXUT - HL IEN^Resource IEN
     204        D
     205        . N $ET S $ET="D ^%ZTER B"
     206        . S HLRESIENS=$$UTCR^BSDXUT(RESNAM)
     207        . I HLRESIENS<0 S $EC=",U1," ; not supposed to happen - hard crash if so
     208        ;
     209        N HLIEN,RESIEN
     210        S HLIEN=$P(HLRESIENS,U)
     211        S RESIEN=$P(HLRESIENS,U,2)
     212        ;
     213        ; Get start and end times
     214        N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
     215        N APPTTIME S APPTTIME=$P(TIMES,U)
     216        N ENDTIME S ENDTIME=$P(TIMES,U,2)
     217        ;
     218        ; Make appt
     219        N ZZZ,DFN
     220        S DFN=3
     221        D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
     222        N APPID S APPID=+$P(^BSDXTMP($J,1),U)
     223        ; Test 1: Sanity Check
     224        D NOSHOW^BSDX31(.ZZZ,APPID,1)
     225        I $P(^BSDXAPPT(APPID,0),U,10)'=1 W "ERROR T1",!
     226        I $P(^DPT(DFN,"S",APPTTIME,0),U,2)'="N" W "ERROR T1",!
     227        ; Test 2: Undo NOSHOW
     228        D NOSHOW^BSDX31(.ZZZ,APPID,0)
     229        I $P(^BSDXAPPT(APPID,0),U,10)'="0" W "ERROR T2",!
     230        I $P(^DPT(DFN,"S",APPTTIME,0),U,2)'="" W "ERROR T2",!
     231        ; Test 3: -1
     232        D NOSHOW^BSDX31(.ZZZ,"",0)
     233        I $P(^BSDXTMP($J,1),U)'=-1 W "ERROR T3",!
     234        ; Test 4: -2
     235        D NOSHOW^BSDX31(.ZZZ,2938748233,0)
     236        I $P(^BSDXTMP($J,1),U)'=-2 W "ERROR T4",!
     237        ; Test 5: -3
     238        D NOSHOW^BSDX31(.ZZZ,APPID,3)
     239        I $P(^BSDXTMP($J,1),U)'=-3 W "ERROR T5",!
     240        ; Test 6: Mumps error (-100)
     241        N BSDXDIE S BSDXDIE=1
     242        D NOSHOW^BSDX31(.ZZZ,APPID,1)
     243        I $P(^BSDXTMP($J,1),U)'=-100 W "ERROR T6",!
     244        K BSDXDIE
     245        ; Test 7: Restartable transaction
     246        N BSDXRESTART S BSDXRESTART=1
     247        D NOSHOW^BSDX31(.ZZZ,APPID,1)
     248        I $P(^BSDXAPPT(APPID,0),U,10)'=1 W "ERROR T7",!
     249        QUIT
Note: See TracChangeset for help on using the changeset viewer.