Ignore:
Timestamp:
Jun 27, 2012, 7:45:33 PM (12 years ago)
Author:
Sam Habiel
Message:

Done refactoring BSDX31 plus all Unit Tests

File:
1 edited

Legend:

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

    r1461 r1462  
    1 BSDXUT1 ; VEN/SMH - Unit Tests for Scheduling GUI - cont. ; 6/26/12 4:36pm
     1BSDXUT1 ; VEN/SMH - Unit Tests for Scheduling GUI - cont. ; 6/27/12 4:59pm
    22        ;;1.7T1;BSDX;;Aug 31, 2011;Build 18
    33        ;
     
    227227        ; Test 2: Undo NOSHOW
    228228        D NOSHOW^BSDX31(.ZZZ,APPID,0)
    229         I $P(^BSDXAPPT(APPID,0),U,10)'="0" W "ERROR T2",!
     229        I $P(^BSDXAPPT(APPID,0),U,10)'="" W "ERROR T2",!
    230230        I $P(^DPT(DFN,"S",APPTTIME,0),U,2)'="" W "ERROR T2",!
    231231        ; Test 3: -1
     
    243243        I $P(^BSDXTMP($J,1),U)'=-100 W "ERROR T6",!
    244244        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",!
     245        ;
     246        ; Test 9
     247        ; Error Simulations
     248        ; Get start and end times
     249        N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
     250        N APPTTIME S APPTTIME=$P(TIMES,U)
     251        N ENDTIME S ENDTIME=$P(TIMES,U,2)
     252        ;
     253        ; This tests if we fail without filing anything
     254        N ZZZ,DFN
     255        S DFN=3
     256        D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
     257        N APPID S APPID=+$P(^BSDXTMP($J,1),U)
     258        N BSDXSIMERR1 S BSDXSIMERR1=1
     259        D NOSHOW^BSDX31(.ZZZ,APPID,1)
     260        I $P(^BSDXTMP($J,1),U)'=-4 W "ERROR T9.1",!
     261        I $P(^BSDXAPPT(APPID,0),U,10)'="" W "ERROR T9.2",!
     262        I $P(^DPT(DFN,"S",APPTTIME,0),U,2)'="" W "ERROR T9.3",!
     263        K BSDXSIMERR1
     264        ;
     265        ; This tests if we fail inside BSDXAPI and have to rollback ^BSDXAPPT
     266        N BSDXSIMERR2 S BSDXSIMERR2=1
     267        D NOSHOW^BSDX31(.ZZZ,APPID,1)
     268        I $P(^BSDXTMP($J,1),U)'=-5 W "ERROR T9.4",!
     269        I $P(^BSDXAPPT(APPID,0),U,10)'="" W "ERROR T9.5",!
     270        I $P(^DPT(DFN,"S",APPTTIME,0),U,2)'="" W "ERROR T9.6",!
     271        K BSDXSIMERR2
     272        ;
     273        ; This test a mumps error in BSDXAPI
     274        N BSDXSIMERR3 S BSDXSIMERR3=1
     275        D NOSHOW^BSDX31(.ZZZ,APPID,1)
     276        I +$P(^BSDXTMP($J,1),U)'=-100 W "ERROR T9.7",!
     277        I $P(^BSDXAPPT(APPID,0),U,10)'="" W "ERROR T9.8",!
     278        K BSDXSIMERR3
     279        ;
     280        ; Test 7: Restartable transaction ; Retired
     281        ;
     282        ; Test 8: UTs for an unlinked resource (not linked to PIMS)
     283        N RESNAM S RESNAM="UTCLINICUL" ; Unlinked Clinic
     284        N RESIEN
     285        D
     286        . N $ET S $ET="D ^%ZTER B"
     287        . S RESIEN=$$UTCRRES^BSDXUT(RESNAM)
     288        . I RESIEN<0 S $EC=",U1," ; not supposed to happen - hard crash if so
     289        ;
     290        ; Get start and end times
     291        N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
     292        N APPTTIME S APPTTIME=$P(TIMES,U)
     293        N ENDTIME S ENDTIME=$P(TIMES,U,2)
     294        ;
     295        ; Make appt
     296        N ZZZ,DFN
     297        S DFN=3
     298        D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
     299        N APPID S APPID=+$P(^BSDXTMP($J,1),U)
     300        ; Test 1: Sanity Check
     301        D NOSHOW^BSDX31(.ZZZ,APPID,1)
     302        I $P(^BSDXAPPT(APPID,0),U,10)'=1 W "ERROR T8.1",!
     303        ; Test 2: Undo NOSHOW
     304        D NOSHOW^BSDX31(.ZZZ,APPID,0)
     305        I $P(^BSDXAPPT(APPID,0),U,10)'="" W "ERROR T8.2",!
     306        ; Test 3: Put it back on...
     307        D NOSHOW^BSDX31(.ZZZ,APPID,1)
     308        I $P(^BSDXAPPT(APPID,0),U,10)'=1 W "ERROR T8.3",!
     309        ;
     310        ;
    249311        QUIT
Note: See TracChangeset for help on using the changeset viewer.