54. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 8/31/2018 11:26:39 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

54.1 Files compared

# Location File Last Modified
1 BMS_Source.zip\Source\Sources\UnitTests\BMS.VistaIntegration.ViaTests ViaVistASessionFactoryTest.cs Thu Aug 30 14:52:24 2018 UTC
2 BMS_Source.zip\Source\Sources\UnitTests\BMS.VistaIntegration.ViaTests ViaVistASessionFactoryTest.cs Fri Aug 31 13:51:02 2018 UTC

54.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 7 2598
Changed 6 12
Inserted 0 0
Removed 0 0

54.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

54.4 Active regular expressions

No regular expressions were active.

54.5 Comparison detail

  1   using Syst em;
  2   using Syst em.Text;
  3   using Syst em.Collect ions.Gener ic;
  4   using Micr osoft.Visu alStudio.T estTools.U nitTesting ;
  5   using BMS. Utils;
  6   using BMS. VistaInteg ration.Dat a;
  7   using BMS. VistaInteg ration.Mdw s;
  8   using BMS. Facade;
  9   using BMS. VistaInteg ration.Vis tA;
  10   using BMS. VistaInteg ration.Via .Commands. WF;
  11   using BMS. VistaInteg ration.Via .Commands;
  12   using Syst em.Linq;
  13   using Syst em.IO;
  14  
  15   namespace  BMS.VistaI ntegration .Via.Tests
  16   {
  17       [TestC lass]
  18       public  class Via VistASessi onFactoryT est
  19       {
  20           pr ivate bool  _compareT oMDWS = tr ue;
  21           pr ivate Site Parameters  _sitePara ms = new S iteParamet ers();
  22           pr ivate Vist ASite _vis taSite = n ull;
  23           pr ivate stri ng _site =  "CHEYL19" ;
  24           // private st ring _site  = "HOUTES T";
  25  
  26           [T estInitial ize()]
  27           pu blic void  InitTests( )
  28           {
  29                switch ( _site)
  30                {
  31                    case  "NTX":
  32                          _vistaSite  = new Vis tASite("te st", "V16N TX", "549" , TimeZone Info.Local , "http:// DNS /QuerySvc. asmx");
  33                         BuildParam sForHousto n();
  34                         break;
  35                    case  "BILOXI":
  36                          _vistaSite  = new Vis tASite("te st", "V16B LX", "520" , TimeZone Info.Local , "http:// DNS /QuerySvc. asmx");
  37                         BuildParam sForHousto n();
  38                         break;
  39                    case  "STL":
  40                          _vistaSite  = new Vis tASite("te st", "V16S TL", "657" , TimeZone Info.Local , "http:// DNS /QuerySvc. asmx");
  41                         BuildParam sForHousto n();
  42                         break;
  43                    case  "HOUSTON" :
  44                          _vistaSite  = new Vis tASite("te st", "V16H OU", "580" , TimeZone Info.Local , "http:// DNS /QuerySvc. asmx");
  45                         BuildParam sForHousto n();
  46                         break;
  47                    case  "CHEYL19" :
  48                          _vistaSite  = new Vis tASite("te st", "CHEY L19", "516 ", TimeZon eInfo.Loca l, "http:/ / DNS /QuerySvc. asmx");
  49                         BuildParam sForCheyl1 9();
  50                         break;
  51                }
  52           }
  53  
  54           pu blic void  BuildParam sForCheyl1 9()
  55           {
  56                _sitePar ams.Patien tIEN = "39 77";
  57                _sitePar ams.Patien tIENWithAd mission =  "7185012";  //7185012 ^DRALEAU,L ORENE^F^26 70331^1016 25668^3041 105^73^202 ^204908~jh kdksdf^0^4 0
  58                _sitePar ams.NewPer sonIEN = " 202";
  59                _sitePar ams.Patien tMovementI EN = "7886 ";
  60                _sitePar ams.Cancel edOrdersIE Ns = new[]  { "558761 0", "55876 20", "5587 630" };
  61                _sitePar ams.listPa tientStart Date = new  DateTime( 2010, 01,  6);
  62                _sitePar ams.listPa tientEndDa te = new D ateTime(20 11, 11, 8) ;
  63                _sitePar ams.listPa tientClini cs = new[]  { "1690"  , "1909",  "1910"};
  64                //_siteP arams.list OrderStart Date = new  DateTime( 2005, 04,  18);  //   missing re cord
  65                //_siteP arams.list OrderEndDa te = new D ateTime(20 05, 04, 20 );
  66                _sitePar ams.listOr derStartDa te = new D ateTime(20 02, 01, 01 );
  67                _sitePar ams.listOr derEndDate  = new Dat eTime(2004 , 08, 12);
  68                _sitePar ams.ordera bleItems =  new[] { " 73", "75",  "76", "20 57" };
  69           }
  70  
  71           pu blic void  BuildParam sForHousto n()
  72           {
  73                _sitePar ams = new  SiteParame ters();
  74                _sitePar ams.Patien tIEN = "48 2243";
  75                _sitePar ams.Patien tIENWithAd mission =  "482238";  // 482238^ SHUYL,ILYY N U^M^2420 426^101523 523^316092 3^52^13772 9^2271498~ MAJOR DEPR ESSION/PSY CHOSIS^0^
  76                _sitePar ams.NewPer sonIEN = " 202";
  77                _sitePar ams.Clinic IEN = "109 ";
  78                _sitePar ams.Patien tSSN = "10 1523523";
  79                _sitePar ams.Patien tMovementI EN = "2160 047";
  80                _sitePar ams.Admiss ionIEN = " 2255839";
  81                _sitePar ams.BulkPa tientIENs  = "504486, 443077,798 54,276189, 306977,454 825,250350 ,163669,44 6769,14289 3,397690,2 49660,4651 01,45193,1 3281,85039 ,387393,38 1871,36549 1,182748,1 3193,14587 1,106778,4 48422,7736 ,397841,10 1930,41064 8,286760,3 59564,8496 6,5549,325 125,231082 ,309510,10 7599,42936 6,13778,24 3353,46053 0,264513,2 83083,3618 81,439994, 140288,216 720,454716 ,7898,7248 0,339985,2 14871,7190 9,292242,4 64450,4612 07,409766, 158993,128 67,312229, 349321,127 638,258465 ,447405,19 2168,26899 3,203451,9 9735,46252 2,143499,4 20623,6209 9,279151,4 47899,3223 59,152341, 214962,152 967,173852 ,256844,41 3739,24908 7,91209,13 204,351365 ,35825,463 915,80240, 266182,418 802,196832 ,434317,25 6842,13321 5,455282,4 49067,1603 73,144365, 360442,264 620,79215, 282064,277 103,185699 ,56846,465 077,296586 ,61868,338 945,429063 ,279825,28 1364,45906 0,141299,2 26870,3419 49,221930, 447421,214 732,174485 ,309876,82 108,275593 ,446021,32 8089,37510 ,427742,46 3635,18401 5,291763,3 64734,3659 11,216422, 242847,240 349,418263 ,136319,15 527,320674 ,463342,15 8328,18190 5,418977,4 2893,4198, 26030,3834 19,423273, 22140,1408 91,429765, 261821,442 07,106029, 406466,442 997,168141 ,54084,376 559,441445 ,49,86227, 167314,287 840,68020, 267474,314 246,28343, 186014,157 552,108518 ,409634,22 2075,16763 8,68496,22 9673,43172 9,466155,4 57505,1194 59,318438, 436105,458 888,383155 ,122548,50 423,72747, 228170,316 314,441344 ,171812,17 2978,30939 1,446050,2 65249,5374 ,464061,45 0146,13720 4,60393,43 3164,22801 9,428185,1 8470,36089 5,257394,3 25947,4586 44,242056, 387625,180 68,82123,1 94853,2615 24,444376, 427085,803 21,116473, 369058,446 986,214538 ,379061,27 0089,37353 6,248932,1 59400,2668 10,366640, 445716,171 769,462407 ,216918,36 2961,31785 3,47759,94 729,135450 ,157188,18 2730,29827 5,14522,35 2041,36764 8,154439,4 34953,4401 95,190689, 433684,334 362,307429 ,67301,465 888,305510 ,446053,35 0516,64977 ,433363,37 3879,37402 ,397190,21 0237,37788 2,145544,4 31316,3518 65,442697, 132947,241 447,217219 ,331609,18 370,28915, 77481,1111 44,466297, 123209,420 596,136748 ,40380,254 627,428823 ,463470,72 580,181475 ,78289,345 041,217722 ,250195,41 0622,24594 8,207852,4 54337,2203 30,390807, 411589,299 472,433144 ,308373,22 2787,44760 7,242523,5 3097,44696 7,199481,3 56494,2672 69,455540, 432358,182 182,453964 ,221940,36 0568,30326 9,75429,29 075,143163 ,307477,11 6586,38403 9,371995,3 64153,2836 0,90666,34 9058,10591 5,205681,3 45922,1582 29,333418, 302257,116 841,291090 ,228636,26 5976,26856 5,275729,2 778,221056 ,317584,43 9086,30068 6,192473,2 30841,3489 43,236847, 442494,445 656,85466, 117232,315 611,78773, 250299,222 839,451618 ,316049,46 1742,14340 1,112047,2 69161,4274 32,156096, 380951,147 29,447315, 189865,286 40,287909, 359999,923 29,292017, 449203,136 310,439741 ,194533,23 8745,28384 9,173806,2 75356,4239 62,316029, 139176,374 151,357351 ,425635,93 055,298880 ,285156,18 959,83535, 294790,125 701,194486 ,448855,44 8614,37242 9,332122,4 7635,75700 ,279278,42 8441,33097 4,378170,4 41806,3351 74,418378, 87300,3600 63,133418, 321728,350 058,422470 ,227754,33 9862,20897 0,21728,64 217,143133 ,320626,76 472,343110 ,229203,37 8029,32644 3,186824,4 48639,1490 94,285624, 111974,668 66,255439, 205634,282 065,4442,2 25843,4484 85,455554, 402092,276 716,459061 ,463414,37 3633,97878 ,314989,37 7218,11066 0,215027,3 80266,6546 3,350474,2 82413,2513 27,262021, 246050,421 604,223793 ,173085,44 7056,16727 3,212076,4 49126,4360 61,119704, 378585,204 856,298587 ,427502,38 3652,72515 ,275035,40 624,165245 ,406005,19 0183,33957 8,55412,43 9181,33331 4,165117,3 20403,4182 62,228633, 253541,272 212,100473 ,415666,54 715,28170, 19424,2407 1,96840,25 7559,33198 2,422855,2 1220,20318 5,146585,1 08875,1969 20,4146,33 5625,31205 4,281142";
  82                _sitePar ams.Cancel edOrdersIE Ns = new[]  { "108465 819", "108 465820" ,  "108465821 " };
  83                _sitePar ams.listPa tientStart Date = new  DateTime( 2015, 01,  6);
  84                _sitePar ams.listPa tientEndDa te = new D ateTime(20 18, 3, 8);
  85                _sitePar ams.listPa tientClini cs = new[]  { "5435",  "5320" };
  86                _sitePar ams.listOr derStartDa te = new D ateTime(20 17, 12, 22 );
  87                _sitePar ams.listOr derEndDate  = new Dat eTime(2017 , 12, 28,  23, 59, 59 );
  88                _sitePar ams.ordera bleItems =  new[] { " 73", "75",  "76", "18 005", "180 03", "1479 5", "13974 ", "13975" , "14215",  "14214" } ;
  89           }
  90  
  91           pu blic IVist AQuery Bui ldVistAQue ry(DataRet rievalMeth od retriev alMethod)
  92           {
  93                IVistAQu ery vistaQ uery = nul l;
  94                switch ( retrievalM ethod)
  95                {
  96                    case  DataRetri evalMethod .MDWS:
  97                         MdwsVistAS ession ses sion = new  MdwsVistA Session(_v istaSite);
  98                         session.Op en(new Vis tAConnecti onInfo(_vi staSite.Md wsEndpoint Url, null,  null));
  99                         vistaQuery  = new Mdw sVistAQuer y(session) ;
  100                         break;
  101                    case  DataRetri evalMethod .VIA:
  102                         vistaQuery  = new Via VistAQuery (new ViaVi stASession (_vistaSit e));
  103                         break;
  104                }
  105  
  106                return v istaQuery;
  107           }
  108  
  109           [T estMethod]
  110           pu blic void  TestListBe dSwitch()
  111           {
  112                try
  113                {
  114                    List <string> i ens = new  List<strin g>() { "1, 2,3" };
  115  
  116                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  117                    ILis t<Data.WF. BedSwitch>  bedSwitch VIA = viaQ uery.GetBe dsSwitch(i ens);
  118  
  119                    Asse rt.IsNotNu ll(bedSwit chVIA);
  120  
  121                    if ( _compareTo MDWS)
  122                    {
  123                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  124                         IList<Data .WF.BedSwi tch> bedSw itchMDWS =  mdwsQuery .GetBedsSw itch(iens) ;
  125  
  126                         Assert.IsN otNull(bed SwitchMDWS );
  127  
  128                         Assert.Are Equal(bedS witchVIA.C ount, bedS witchMDWS. Count);
  129  
  130                         Assert.Are Equal(bedS witchVIA.F irst().IEN , bedSwitc hMDWS.Firs t().IEN);
  131                         Assert.Are Equal(bedS witchVIA.F irst().War dIen, bedS witchMDWS. First().Wa rdIen);
  132  
  133                         Assert.Are Equal(bedS witchVIA.L ast().IEN,  bedSwitch MDWS.Last( ).IEN);
  134                         Assert.Are Equal(bedS witchVIA.L ast().Ward Ien, bedSw itchMDWS.L ast().Ward Ien);
  135                    }
  136                }
  137                catch (E xception e x)
  138                {
  139                    Asse rt.Fail(ex .ToString( ));
  140                }
  141           }
  142  
  143           [T estMethod]
  144           pu blic void  TestListPa tientByDat e() // MDW S returns  more resul ts because  it list p atients by  book-ende d IENs ins tead of da tes. Some  entries do  not have  dates in H OUTEST. Te st fails a s a result
  145           {
  146                try
  147                {
  148                    Date Time start Date = new  DateTime( 2018, 01,  01);
  149                    Date Time endDa te = new D ateTime(20 18, 01, 07 );
  150  
  151                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  152  
  153                    Date Time befor eVIA = Dat eTime.Now;
  154                    ILis t<Patient>  patientsV IA = viaQu ery.GetPat ients(star tDate, end Date);
  155                    Date Time after VIA = Date Time.Now;
  156                    Time Span durat ionVIA = a fterVIA -  beforeVIA;
  157  
  158                    Asse rt.IsNotNu ll(patient sVIA);
  159  
  160                    Sort edList<str ing, Patie nt> viaMap  = new Sor tedList<st ring, Pati ent>(patie ntsVIA.ToD ictionary( item => it em.IEN));
  161  
  162                    if ( _compareTo MDWS)
  163                    {
  164                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  165                         IList<Pati ent> patie ntsMDWS =  mdwsQuery. GetPatient s(startDat e, endDate );
  166  
  167                         Assert.IsN otNull(pat ientsMDWS) ;
  168  
  169                         SortedList <string, P atient> md wsMap = ne w SortedLi st<string,  Patient>( patientsMD WS.ToDicti onary(item  => item.I EN));
  170  
  171                         SortedList <string, P atient> on lyInVia =  new Sorted List<strin g, Patient >();
  172                         SortedList <string, P atient> on lyInMdws =  new Sorte dList<stri ng, Patien t>();
  173  
  174                         foreach (s tring pati entIen in  viaMap.Key s)
  175                         {
  176                             if (!m dwsMap.Con tainsKey(p atientIen) )
  177                                 on lyInVia.Ad d(patientI en, viaMap [patientIe n]);
  178                         }
  179  
  180                         foreach (s tring pati entIen in  mdwsMap.Ke ys)
  181                         {
  182                             if (!v iaMap.Cont ainsKey(pa tientIen))
  183                                 on lyInMdws.A dd(patient Ien, mdwsM ap[patient Ien]);
  184                         }
  185  
  186                         Assert.Are Equal(pati entsVIA.Co unt, patie ntsMDWS.Co unt);
  187                    }
  188  
  189                    // T ODO - chec k fields h ave expect ed values  and match  between VI A/MDWS
  190                }
  191                catch (E xception e x)
  192                {
  193                    Asse rt.Fail(ex .ToString( ));
  194                }
  195           }
  196  
  197           [T estMethod]
  198           pu blic void  TestListPa tientByIEN () // VIA  appears to  work. MDW S seems to  ignore Pa tientIEN f ilter.
  199           {
  200                // spide rs out on  Attending  Physician  to "NewPer son" and F acilityTre atingSpeci alty - "Tr eatingSpec ialty"
  201                try
  202                {
  203                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  204  
  205                    Date Time befor eVIA = Dat eTime.Now;
  206                    ILis t<Patient>  patientsV IA = viaQu ery.GetPat ients(null , null, _s iteParams. BulkPatien tIENs);
  207                    Date Time after VIA = Date Time.Now;
  208                    Time Span durat ionVIA = a fterVIA -  beforeVIA;
  209  
  210                    Asse rt.IsNotNu ll(patient sVIA);
  211  
  212                    //if  (_compare ToMDWS)
  213                    //{
  214                    //     IVistAQu ery mdwsQu ery = Buil dVistAQuer y(DataRetr ievalMetho d.MDWS);
  215                    //     IList<Pa tient> pat ientsMDWS  = mdwsQuer y.GetPatie nts(null,  null, _sit eParams.Pa tientIEN);
  216  
  217                    //     Assert.I sNotNull(p atientsMDW S);
  218  
  219                    //     Assert.A reEqual(pa tientsVIA. Count, pat ientsMDWS. Count);
  220                    //}
  221  
  222                    // T ODO - chec k fields h ave expect ed values  and match  between VI A/MDWS
  223                }
  224                catch (E xception e x)
  225                {
  226                    Asse rt.Fail(ex .ToString( ));
  227                }
  228           }
  229  
  230           [T estMethod]
  231           pu blic void  TestGetPat ient()
  232           {
  233                try
  234                {
  235                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  236  
  237                    Date Time befor eVIA = Dat eTime.Now;
  238                    Pati ent patien tVIA = via Query.GetP atientByIe n(_sitePar ams.Patien tIEN);
  239                    Date Time after VIA = Date Time.Now;
  240                    Time Span durat ionVIA = a fterVIA -  beforeVIA;
  241  
  242                    Asse rt.IsNotNu ll(patient VIA);
  243  
  244                    if ( _compareTo MDWS)
  245                    {
  246                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  247                         Patient pa tientMDWS  = mdwsQuer y.GetPatie ntByIen(_s iteParams. PatientIEN );
  248  
  249                         Assert.IsN otNull(pat ientMDWS);
  250  
  251                         // check f ields have  expected  values and  match bet ween VIA/M DWS
  252                         Assert.Are Equal(pati entVIA.IEN , patientM DWS.IEN);
  253                         Assert.Are Equal(pati entVIA.Soc ialSecurit yNumber, p atientMDWS .SocialSec urityNumbe r);
  254                    }
  255                }
  256                catch (E xception e x)
  257                {
  258                    Asse rt.Fail(ex .ToString( ));
  259                }
  260           }
  261  
  262           [T estMethod]
  263           pu blic void  TestListAd mittedPati entsForUpd ate()
  264           {
  265                try
  266                {
  267                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  268  
  269                    Date Time befor eVIA = Dat eTime.Now;
  270                    ILis t<Patient>  patientsV IA = viaQu ery.GetAdm ittedPatie ntsForUpda te();
  271                    Date Time after VIA = Date Time.Now;
  272                    Time Span durat ionVIA = a fterVIA -  beforeVIA;
  273  
  274                    Asse rt.IsNotNu ll(patient sVIA);
  275  
  276                    if ( _compareTo MDWS)
  277                    {
  278                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  279                         IList<Pati ent> patie ntsMDWS =  mdwsQuery. GetAdmitte dPatientsF orUpdate() ;
  280  
  281                         Assert.IsN otNull(pat ientsMDWS) ;
  282  
  283                         Assert.Are Equal(pati entsVIA.Co unt, patie ntsMDWS.Co unt);
  284  
  285                         Assert.Are Equal(pati entsVIA.Fi rst().IEN,  patientsM DWS.First( ).IEN);
  286                         Assert.Are Equal(pati entsVIA.Fi rst().Soci alSecurity Number, pa tientsMDWS .First().S ocialSecur ityNumber) ;
  287                         Assert.Are Equal(pati entsVIA.Fi rst().Admi ssionIen,  patientsMD WS.First() .Admission Ien);
  288                         Assert.Are Equal(pati entsVIA.Fi rst().Admi ttingDiagn osis, pati entsMDWS.F irst().Adm ittingDiag nosis);
  289                         Assert.Are Equal(pati entsVIA.Fi rst().Trea tingSpecia ltyId, pat ientsMDWS. First().Tr eatingSpec ialtyId);
  290                    }
  291                }
  292                catch (E xception e x)
  293                {
  294                    Asse rt.Fail(ex .ToString( ));
  295                }
  296           }
  297  
  298           // [TestMetho d]  // not  implement ed excepti on
  299           pu blic void  TestGetPat ientBySSN( )
  300           {
  301                try
  302                {
  303                    ILis t<string>  patientSSN s = new Li st<string> () { _site Params.Pat ientSSN };  // TODO -  add ssns
  304  
  305                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  306  
  307                    Date Time befor eVIA = Dat eTime.Now;
  308                    ILis t<Patient>  patientsV IA = viaQu ery.GetPat ients(pati entSSNs);
  309                    Date Time after VIA = Date Time.Now;
  310                    Time Span durat ionVIA = a fterVIA -  beforeVIA;
  311  
  312                    Asse rt.IsNotNu ll(patient sVIA);
  313  
  314                    if ( _compareTo MDWS)
  315                    {
  316                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  317                         IList<Pati ent> patie ntsMDWS =  mdwsQuery. GetPatient s(patientS SNs);
  318  
  319                         Assert.IsN otNull(pat ientsMDWS) ;
  320  
  321                         Assert.Are Equal(pati entsVIA.Co unt, patie ntsMDWS.Co unt);
  322  
  323                         // check f ields have  expected  values and  match bet ween VIA/M DWS
  324                         Assert.Are Equal(pati entsVIA.Fi rst().IEN,  patientsM DWS.First( ).IEN);
  325                         Assert.Are Equal(pati entsVIA.Fi rst().Soci alSecurity Number, pa tientsMDWS .First().S ocialSecur ityNumber) ;
  326  
  327                         Assert.Are Equal(pati entsVIA.La st().IEN,  patientsMD WS.Last(). IEN);
  328                         Assert.Are Equal(pati entsVIA.La st().Socia lSecurityN umber, pat ientsMDWS. Last().Soc ialSecurit yNumber);
  329                    }
  330                }
  331                catch (E xception e x)
  332                {
  333                    Asse rt.Fail(ex .ToString( ));
  334                }
  335           }
  336  
  337           [T estMethod]
  338           pu blic void  TestListAd mittedPati ents()
  339           {
  340                try
  341                {
  342                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  343  
  344                    Date Time befor eVIA = Dat eTime.Now;
  345                    ILis t<Admitted Patient> p atientsVIA  = viaQuer y.GetAdmit tedPatient s(_sitePar ams.Patien tMovementI EN);
  346                    Date Time after VIA = Date Time.Now;
  347                    Time Span durat ionVIA = a fterVIA -  beforeVIA;
  348  
  349                    Asse rt.IsNotNu ll(patient sVIA);
  350  
  351                    if ( _compareTo MDWS)
  352                    {
  353                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  354                         IList<Admi ttedPatien t> patient sMDWS = md wsQuery.Ge tAdmittedP atients(_s iteParams. PatientMov ementIEN);
  355  
  356                         Assert.IsN otNull(pat ientsMDWS) ;
  357  
  358                         Assert.Are Equal(pati entsVIA.Co unt, patie ntsMDWS.Co unt);
  359  
  360                         Assert.Are Equal(pati entsVIA.Fi rst().IEN,  patientsM DWS.First( ).IEN);
  361                         Assert.Are Equal(pati entsVIA.Fi rst().Name , patients MDWS.First ().Name);
  362                         Assert.Are Equal(pati entsVIA.Fi rst().Admi ssionIen,  patientsMD WS.First() .Admission Ien);
  363                         Assert.Are Equal(pati entsVIA.Fi rst().Move mentIen, p atientsMDW S.First(). MovementIe n);
  364                         Assert.Are Equal(pati entsVIA.Fi rst().Ward Name, pati entsMDWS.F irst().War dName);
  365                         Assert.Are Equal(pati entsVIA.Fi rst().BedN ame, patie ntsMDWS.Fi rst().BedN ame);
  366  
  367                         Assert.Are Equal(pati entsVIA.La st().IEN,  patientsMD WS.Last(). IEN);
  368                         Assert.Are Equal(pati entsVIA.La st().Name,  patientsM DWS.Last() .Name);
  369                         Assert.Are Equal(pati entsVIA.La st().Admis sionIen, p atientsMDW S.Last().A dmissionIe n);
  370                         Assert.Are Equal(pati entsVIA.La st().Movem entIen, pa tientsMDWS .Last().Mo vementIen) ;
  371                         Assert.Are Equal(pati entsVIA.La st().WardN ame, patie ntsMDWS.La st().WardN ame);
  372                         Assert.Are Equal(pati entsVIA.La st().BedNa me, patien tsMDWS.Las t().BedNam e);
  373                    }
  374                }
  375                catch (E xception e x)
  376                {
  377                    Asse rt.Fail(ex .ToString( ));
  378                }
  379           }
  380  
  381           [T estMethod]
  382           pu blic void  TestGetWar dLocations ()
  383           {
  384                try
  385                {
  386                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  387  
  388                    Date Time befor eVIA = Dat eTime.Now;
  389                    ILis t<WardLoca tion> ward LocationsV IA = viaQu ery.GetWar dLocations ();
  390                    Date Time after VIA = Date Time.Now;
  391                    Time Span durat ionVIA = a fterVIA -  beforeVIA;
  392  
  393                    Asse rt.IsNotNu ll(wardLoc ationsVIA) ;
  394  
  395                    if ( _compareTo MDWS)
  396                    {
  397                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  398                         IList<Ward Location>  wardLocati onsMDWS =  mdwsQuery. GetWardLoc ations();
  399  
  400                         Assert.IsN otNull(war dLocations MDWS);
  401  
  402                         Assert.Are Equal(ward LocationsV IA.Count,  wardLocati onsMDWS.Co unt);
  403  
  404                         // check f ields have  expected  values and  match bet ween VIA/M DWS
  405                         Assert.Are Equal(ward LocationsM DWS.First( ).IEN, war dLocations VIA.First( ).IEN);
  406                         Assert.Are Equal(ward LocationsM DWS.First( ).Specialt y.Name, wa rdLocation sVIA.First ().Special ty.Name);
  407  
  408                         Assert.Are Equal(ward LocationsM DWS.Last() .IEN, ward LocationsV IA.Last(). IEN);
  409                         Assert.Are Equal(ward LocationsM DWS.Last() .Specialty .Name, war dLocations VIA.Last() .Specialty .Name);
  410                    }
  411                }
  412                catch (E xception e x)
  413                {
  414                    Asse rt.Fail(ex .ToString( ));
  415                }
  416           }
  417  
  418           [T estMethod]
  419           pu blic void  TestGetHos pitalLocat ions()
  420           {
  421                try
  422                {
  423                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  424                    ILis t<Hospital Location>  hospitalLo cationsVIA  = viaQuer y.GetHospi talLocatio ns();
  425  
  426                    fore ach (Hospi talLocatio n hospital Location i n hospital LocationsV IA)
  427                    {
  428                         if (hospit alLocation .WardLocat ion != nul l)
  429                             break;
  430                    }
  431  
  432                    Dict ionary<str ing, Hospi talLocatio n> viaMap  = new Dict ionary<str ing, Hospi talLocatio n>();
  433                    viaM ap = hospi talLocatio nsVIA.ToDi ctionary(i tem => ite m.IEN);
  434  
  435                    Asse rt.IsNotNu ll(hospita lLocations VIA);
  436  
  437                    if ( _compareTo MDWS)
  438                    {
  439                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  440                         IList<Hosp italLocati on> hospit alLocation sMDWS = md wsQuery.Ge tHospitalL ocations() ;
  441  
  442                         Assert.IsN otNull(hos pitalLocat ionsMDWS);
  443  
  444                         Dictionary <string, H ospitalLoc ation> mdw sMap = new  Dictionar y<string,  HospitalLo cation>();
  445                         mdwsMap =  hospitalLo cationsVIA .ToDiction ary(item = > item.IEN );
  446  
  447                         Assert.Are Equal(hosp italLocati onsVIA.Cou nt, hospit alLocation sMDWS.Coun t);
  448                    }
  449  
  450                    // T ODO - chec k fields h ave expect ed values  and match  between VI A/MDWS
  451                }
  452                catch (E xception e x)
  453                {
  454                    Asse rt.Fail(ex .ToString( ));
  455                }
  456           }
  457  
  458           // [TestMetho d] // this  method do es not app ear to hav e a use-ca se and doe s not work  with MDWS . VIA seem s to work.
  459           pu blic void  TestListNe wPersonByD ateRange()
  460           {
  461                try
  462                {
  463                    Date Time start Date = new  DateTime( 2006, 02,  25); // TO DO - set d ates
  464                    Date Time endDa te = new D ateTime(20 06, 03, 01 , 23, 59,  59);
  465  
  466                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  467  
  468                    Date Time befor eVIA = Dat eTime.Now;
  469                    ILis t<NewPerso n> newPers onsVIA = v iaQuery.Ge tNewPerson s(startDat e, endDate );
  470                    Date Time after VIA = Date Time.Now;
  471                    Time Span durat ionVIA = a fterVIA -  beforeVIA;
  472  
  473                    Asse rt.IsNotNu ll(newPers onsVIA);
  474  
  475                    if ( _compareTo MDWS)
  476                    {
  477                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  478                         IList<NewP erson> new PersonsMDW S = mdwsQu ery.GetNew Persons(st artDate, e ndDate);
  479  
  480                         Assert.IsN otNull(new PersonsMDW S);
  481  
  482                         Assert.Are Equal(newP ersonsVIA. Count, new PersonsMDW S.Count);
  483  
  484                         // Check f ields have  expected  values and  match bet ween VIA/M DWS
  485                         Assert.Are Equal(newP ersonsVIA. First().IE N, newPers onsMDWS.Fi rst().IEN) ;
  486                         Assert.Are Equal(newP ersonsVIA. First().Na me, newPer sonsMDWS.F irst().Nam e);
  487  
  488                         Assert.Are Equal(newP ersonsVIA. Last().IEN , newPerso nsMDWS.Las t().IEN);
  489                         Assert.Are Equal(newP ersonsVIA. Last().Nam e, newPers onsMDWS.La st().Name) ;
  490                    }
  491                }
  492                catch (E xception e x)
  493                {
  494                    Asse rt.Fail(ex .ToString( ));
  495                }
  496           }
  497  
  498           [T estMethod]
  499           pu blic void  TestListNe wPersonByI EN()
  500           {
  501                // ListN ewPerson i s normally  called dy namically  in a "spid er out" ca ll from Li stPatient
  502                try
  503                {
  504                    ViaV istAQuery  viaQuery =  BuildVist AQuery(Dat aRetrieval Method.VIA ) as ViaVi stAQuery;
  505  
  506                    // m ake dynami c call to  VIA comman d for new  person
  507                    stri ng target  = BMS.Vist aIntegrati on.Via.Com mands.EIS. ListNewPer sonCommand .Target;
  508                    int  argumentCo unt = BMS. VistaInteg ration.Via .Commands. EIS.ListNe wPersonCom mand.Argum entsCount;
  509  
  510                    List <NewPerson > newPerso nsVIA = vi aQuery.Get Results(ne w EntitySe tCache.Bul kEntitiesL istCommand <NewPerson >(viaQuery , target,  new string [] { _site Params.New PersonIEN  }, argumen tCount, nu ll));
  511                    Asse rt.IsNotNu ll(newPers onsVIA);
  512  
  513                    // T ODO - chec k fields h ave expect ed values  and match  between VI A/MDWS
  514                }
  515                catch (E xception e x)
  516                {
  517                    Asse rt.Fail(ex .ToString( ));
  518                }
  519           }
  520  
  521           [T estMethod]
  522           pu blic void  TestListSp ecialty()
  523           {
  524                try
  525                {
  526                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  527  
  528                    Date Time befor eVIA = Dat eTime.Now;
  529                    ILis t<Specialt y> special tiesVIA =  viaQuery.G etSpecialt ies();
  530                    Date Time after VIA = Date Time.Now;
  531                    Time Span durat ionVIA = a fterVIA -  beforeVIA;
  532  
  533                    Asse rt.IsNotNu ll(special tiesVIA);
  534  
  535                    if ( _compareTo MDWS)
  536                    {
  537                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  538                         IList<Spec ialty> spe cialtiesMD WS = mdwsQ uery.GetSp ecialties( );
  539  
  540                         Assert.IsN otNull(spe cialtiesMD WS);
  541  
  542                         Assert.Are Equal(spec ialtiesVIA .Count, sp ecialtiesM DWS.Count) ;
  543  
  544                         Assert.Are Equal(spec ialtiesVIA .First().N ame, speci altiesMDWS .First().N ame);
  545                         Assert.Are Equal(spec ialtiesVIA .First().I EN, specia ltiesMDWS. First().IE N);
  546  
  547                         Assert.Are Equal(spec ialtiesVIA .Last().Na me, specia ltiesMDWS. Last().Nam e);
  548                         Assert.Are Equal(spec ialtiesVIA .Last().IE N, special tiesMDWS.L ast().IEN) ;
  549                    }
  550                }
  551                catch (E xception e x)
  552                {
  553                    Asse rt.Fail(ex .ToString( ));
  554                }
  555           }
  556  
  557           // [TestMetho d] // Not  implemente d
  558           pu blic void  TestListWa rdLocation ()
  559           {
  560                // can't  find MDWS  or VIA im plementati on. There  is a GetWa rdLocation s, but tha t's alread y tested a bove.
  561                throw ne w NotImple mentedExce ption();
  562           }
  563  
  564           [T estMethod]
  565           pu blic void  TestListFa cilityMove mentTypes( )
  566           {
  567                try
  568                {
  569                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  570                    ILis t<Facility MovementTy pe> facili tyMovement TypesVIA =  viaQuery. GetFacilit yMovementT ypes();
  571  
  572                    Asse rt.IsNotNu ll(facilit yMovementT ypesVIA);
  573  
  574                    if ( _compareTo MDWS)
  575                    {
  576                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  577                         IList<Faci lityMoveme ntType> fa cilityMove mentTypesM DWS = mdws Query.GetF acilityMov ementTypes ();
  578  
  579                         Assert.IsN otNull(fac ilityMovem entTypesMD WS);
  580  
  581                         Assert.Are Equal(faci lityMoveme ntTypesVIA .Count, fa cilityMove mentTypesM DWS.Count) ;
  582  
  583                         Assert.Are Equal(faci lityMoveme ntTypesVIA .First().N ame, facil ityMovemen tTypesMDWS .First().N ame);
  584                         Assert.Are Equal(faci lityMoveme ntTypesVIA .First().I EN, facili tyMovement TypesMDWS. First().IE N);
  585                         Assert.Are Equal(faci lityMoveme ntTypesVIA .First().A ctive, fac ilityMovem entTypesMD WS.First() .Active);
  586  
  587                         Assert.Are Equal(faci lityMoveme ntTypesVIA .Last().Na me, facili tyMovement TypesMDWS. Last().Nam e);
  588                         Assert.Are Equal(faci lityMoveme ntTypesVIA .Last().IE N, facilit yMovementT ypesMDWS.L ast().IEN) ;
  589                         Assert.Are Equal(faci lityMoveme ntTypesVIA .Last().Ac tive, faci lityMoveme ntTypesMDW S.Last().A ctive);
  590                    }
  591                }
  592                catch (E xception e x)
  593                {
  594                    Asse rt.Fail(ex .ToString( ));
  595                }
  596           }
  597  
  598           [T estMethod]
  599           pu blic void  TestListFa cilityTrea tingSpecia lties()
  600           {
  601                try
  602                {
  603                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  604                    ILis t<Facility TreatingSp ecialty> f acilityTre atingSpeci altiesVIA  = viaQuery .GetFacili tyTreating Specialtie s();
  605  
  606                    Asse rt.IsNotNu ll(facilit yTreatingS pecialties VIA);
  607  
  608                    if ( _compareTo MDWS)
  609                    {
  610                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  611                         IList<Faci lityTreati ngSpecialt y> facilit yTreatingS pecialties MDWS = mdw sQuery.Get FacilityTr eatingSpec ialties();
  612  
  613                         Assert.IsN otNull(fac ilityTreat ingSpecial tiesMDWS);
  614  
  615                         Assert.Are Equal(faci lityTreati ngSpecialt iesVIA.Cou nt, facili tyTreating Specialtie sMDWS.Coun t);
  616  
  617                         Assert.Are Equal(faci lityTreati ngSpecialt iesVIA.Fir st().Name,  facilityT reatingSpe cialtiesMD WS.First() .Name);
  618                         Assert.Are Equal(faci lityTreati ngSpecialt iesVIA.Fir st().IEN,  facilityTr eatingSpec ialtiesMDW S.First(). IEN);
  619                         Assert.Are Equal(faci lityTreati ngSpecialt iesVIA.Fir st().Speci altyId, fa cilityTrea tingSpecia ltiesMDWS. First().Sp ecialtyId) ;
  620  
  621                         Assert.Are Equal(faci lityTreati ngSpecialt iesVIA.Las t().Name,  facilityTr eatingSpec ialtiesMDW S.Last().N ame);
  622                         Assert.Are Equal(faci lityTreati ngSpecialt iesVIA.Las t().IEN, f acilityTre atingSpeci altiesMDWS .Last().IE N);
  623                         Assert.Are Equal(faci lityTreati ngSpecialt iesVIA.Las t().Specia ltyId, fac ilityTreat ingSpecial tiesMDWS.L ast().Spec ialtyId);
  624                    }
  625                }
  626                catch (E xception e x)
  627                {
  628                    Asse rt.Fail(ex .ToString( ));
  629                }
  630           }
  631  
  632           // [TestMetho d]  // not  implement ed excepti on
  633           pu blic void  TestListMa sMovementT ransaction Type()
  634           {
  635                // can't  find MDWS  or VIA im plementati on
  636                throw ne w NotImple mentedExce ption();
  637           }
  638  
  639           [T estMethod]
  640           pu blic void  TestListMe dicalCente rDivision( )
  641           {
  642                try
  643                {
  644                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  645                    ILis t<MedicalC enterDivis ion> medic alCenterDi visionsVIA  = viaQuer y.GetMedic alCenterDi visions();
  646  
  647                    Asse rt.IsNotNu ll(medical CenterDivi sionsVIA);
  648  
  649                    if ( _compareTo MDWS)
  650                    {
  651                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  652                         IList<Medi calCenterD ivision> m edicalCent erDivision MDWS = mdw sQuery.Get MedicalCen terDivisio ns();
  653  
  654                         Assert.IsN otNull(med icalCenter DivisionMD WS);
  655  
  656                         Assert.Are Equal(medi calCenterD ivisionsVI A.Count, m edicalCent erDivision MDWS.Count );
  657  
  658                         Assert.Are Equal(medi calCenterD ivisionsVI A.First(). Name, medi calCenterD ivisionMDW S.First(). Name);
  659                         Assert.Are Equal(medi calCenterD ivisionsVI A.First(). IEN, medic alCenterDi visionMDWS .First().I EN);
  660                         Assert.Are Equal(medi calCenterD ivisionsVI A.First(). FacilityNu mber, medi calCenterD ivisionMDW S.First(). FacilityNu mber);
  661  
  662                         Assert.Are Equal(medi calCenterD ivisionsVI A.Last().N ame, medic alCenterDi visionMDWS .Last().Na me);
  663                         Assert.Are Equal(medi calCenterD ivisionsVI A.Last().I EN, medica lCenterDiv isionMDWS. Last().IEN );
  664                         Assert.Are Equal(medi calCenterD ivisionsVI A.Last().F acilityNum ber, medic alCenterDi visionMDWS .Last().Fa cilityNumb er);
  665                    }
  666                }
  667                catch (E xception e x)
  668                {
  669                    Asse rt.Fail(ex .ToString( ));
  670                }
  671           }
  672  
  673           [T estMethod]
  674           pu blic void  TestListOr derableIte ms()
  675           {
  676                try
  677                {
  678                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  679                    ILis t<Orderabl eItem> ord erableItem sVIA = via Query.GetO rderableIt ems();
  680  
  681                    Asse rt.IsNotNu ll(orderab leItemsVIA );
  682  
  683                    if ( _compareTo MDWS)
  684                    {
  685                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  686                         IList<Orde rableItem>  orderable ItemsMDWS  = mdwsQuer y.GetOrder ableItems( );
  687  
  688                         Assert.IsN otNull(ord erableItem sMDWS);
  689  
  690                         Assert.Are Equal(orde rableItems VIA.Count,  orderable ItemsMDWS. Count);
  691                    }
  692  
  693                    // T ODO - chec k fields h ave expect ed values  and match  between VI A/MDWS
  694                }
  695                catch (E xception e x)
  696                {
  697                    Asse rt.Fail(ex .ToString( ));
  698                }
  699           }
  700  
  701           [T estMethod]
  702           pu blic void  TestListOr derStatuse s()
  703           {
  704                try
  705                {
  706                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  707                    ILis t<OrderSta tus> order StatusesVI A = viaQue ry.GetOrde rStatuses( );
  708  
  709                    Asse rt.IsNotNu ll(orderSt atusesVIA) ;
  710  
  711                    if ( _compareTo MDWS)
  712                    {
  713                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  714                         IList<Orde rStatus> o rderStatus esMDWS = m dwsQuery.G etOrderSta tuses();
  715  
  716                         Assert.IsN otNull(ord erStatuses MDWS);
  717  
  718                         Assert.Are Equal(orde rStatusesV IA.Count,  orderStatu sesMDWS.Co unt);
  719  
  720                         Assert.Are Equal(orde rStatusesV IA.First() .Name, ord erStatuses MDWS.First ().Name);
  721                         Assert.Are Equal(orde rStatusesV IA.First() .IEN, orde rStatusesM DWS.First( ).IEN);
  722  
  723                         Assert.Are Equal(orde rStatusesV IA.Last(). Name, orde rStatusesM DWS.Last() .Name);
  724                         Assert.Are Equal(orde rStatusesV IA.Last(). IEN, order StatusesMD WS.Last(). IEN);
  725                    }
  726                }
  727                catch (E xception e x)
  728                {
  729                    Asse rt.Fail(ex .ToString( ));
  730                }
  731           }
  732  
  733           //  not imple mented exc eption
  734           pr ivate void  TestGetPa tientMovem ent(string  patientIE N, DateTim e movement Date, Move mentTransa ctionType  movementTy pe)
  735           {
  736                try
  737                {
  738                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  739                    Pati entMovemen t patientM ovementVIA  = viaQuer y.GetPatie ntMovement (patientIE N, movemen tDate, mov ementType) ;
  740  
  741                    Asse rt.IsNotNu ll(patient MovementVI A);
  742  
  743                    if ( _compareTo MDWS)
  744                    {
  745                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  746                         PatientMov ement pati entMovemen tMDWS = md wsQuery.Ge tPatientMo vement(pat ientIEN, m ovementDat e, movemen tType);
  747  
  748                         Assert.IsN otNull(pat ientMoveme ntMDWS);
  749  
  750                         // Check f ields have  expected  values and  match bet ween VIA/M DWS
  751                         Assert.Are Equal(pati entMovemen tVIA.IEN,  patientMov ementMDWS. IEN);
  752                         Assert.Are Equal(pati entMovemen tVIA.DateT ime, patie ntMovement MDWS.DateT ime);
  753                         Assert.Are Equal(pati entMovemen tVIA.Enter edById, pa tientMovem entMDWS.En teredById) ;
  754                         Assert.Are Equal(pati entMovemen tVIA.Patie ntId, pati entMovemen tMDWS.Pati entId);
  755                         Assert.Are Equal(pati entMovemen tVIA.Curre ntAdmissio nIen, pati entMovemen tMDWS.Curr entAdmissi onIen);
  756                         Assert.Are Equal(pati entMovemen tVIA.Enter edById, pa tientMovem entMDWS.En teredById) ;
  757                         Assert.Are Equal(pati entMovemen tVIA.RoomB edId, pati entMovemen tMDWS.Room BedId);
  758                         Assert.Are Equal(pati entMovemen tVIA.Trans actionType Id, patien tMovementM DWS.Transa ctionTypeI d);
  759                         Assert.Are Equal(pati entMovemen tVIA.TypeO fMovementI d, patient MovementMD WS.TypeOfM ovementId) ;
  760                         Assert.Are Equal(pati entMovemen tVIA.WardL ocationId,  patientMo vementMDWS .WardLocat ionId);
  761                    }
  762                }
  763                catch (E xception e x)
  764                {
  765                    Asse rt.Fail(ex .ToString( ));
  766                }
  767           }
  768  
  769           //  [TestMeth od]  // no t implemen ted except ion
  770           pu blic void  TestGetPat ientMoveme ntForAdmis sion() 
  771           {
  772                try
  773                {
  774                    Date Time movem entDate =  new DateTi me(2018, 1 , 26);
  775  
  776                    Test GetPatient Movement(" 288567", m ovementDat e, Movemen tTransacti onType.ADM ISSION);
  777                }
  778                catch (E xception e x)
  779                {
  780                    Asse rt.Fail(ex .ToString( ));
  781                }
  782           }
  783  
  784           // [TestMetho d]  // not  implement ed excepti on
  785           pu blic void  TestGetPat ientMoveme ntForDisch arge()
  786           {
  787                try
  788                {
  789                    Date Time movem entDate =  new DateTi me(2010, 1 , 1); // T ODO get da te
  790  
  791                    Test GetPatient Movement(_ siteParams .PatientIE N, movemen tDate, Mov ementTrans actionType .DISCHARGE );
  792                }
  793                catch (E xception e x)
  794                {
  795                    Asse rt.Fail(ex .ToString( ));
  796                }
  797           }
  798  
  799           // [TestMetho d]  // not  implement ed excepti on
  800           pu blic void  TestGetPat ientMoveme ntForSpeci altyTransf er()
  801           {
  802                try
  803                {
  804                    Date Time movem entDate =  new DateTi me(2010, 1 , 1); // T ODO get da te
  805  
  806                    Test GetPatient Movement(_ siteParams .PatientIE N, movemen tDate, Mov ementTrans actionType .SPECIALTY _TRANSFER) ;
  807                }
  808                catch (E xception e x)
  809                {
  810                    Asse rt.Fail(ex .ToString( ));
  811                }
  812           }
  813  
  814           // [TestMetho d]  // not  implement ed excepti on
  815           pu blic void  TestGetPat ientMoveme ntForTrans fer()
  816           {
  817                try
  818                {
  819                    Date Time movem entDate =  new DateTi me(2010, 1 , 1); // T ODO get da te
  820  
  821                    Test GetPatient Movement(_ siteParams .PatientIE N, movemen tDate, Mov ementTrans actionType .TRANSFER) ;
  822                }
  823                catch (E xception e x)
  824                {
  825                    Asse rt.Fail(ex .ToString( ));
  826                }
  827           }
  828  
  829           [T estMethod]
  830           pu blic void  TestGetPat ientMoveme ntByIEN()
  831           {
  832                try
  833                {
  834                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  835                    Pati entMovemen t patientM ovementVIA  = viaQuer y.GetPatie ntMovement ByIen(_sit eParams.Pa tientMovem entIEN);
  836  
  837                    Asse rt.IsNotNu ll(patient MovementVI A);
  838  
  839                    if ( _compareTo MDWS)
  840                    {
  841                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  842                         PatientMov ement pati entMovemen tMDWS = md wsQuery.Ge tPatientMo vementByIe n(_sitePar ams.Patien tMovementI EN);
  843  
  844                         Assert.IsN otNull(pat ientMoveme ntMDWS);
  845  
  846                         // Check f ields have  expected  values and  match bet ween VIA/M DWS
  847                         Assert.Are Equal(pati entMovemen tVIA.IEN,  patientMov ementMDWS. IEN);
  848                         Assert.Are Equal(pati entMovemen tVIA.DateT ime, patie ntMovement MDWS.DateT ime);
  849                         Assert.Are Equal(pati entMovemen tVIA.Enter edById, pa tientMovem entMDWS.En teredById) ;
  850                         Assert.Are Equal(pati entMovemen tVIA.Patie ntId, pati entMovemen tMDWS.Pati entId);
  851                         Assert.Are Equal(pati entMovemen tVIA.Curre ntAdmissio nIen, pati entMovemen tMDWS.Curr entAdmissi onIen);
  852                         Assert.Are Equal(pati entMovemen tVIA.Enter edById, pa tientMovem entMDWS.En teredById) ;
  853                         Assert.Are Equal(pati entMovemen tVIA.RoomB edId, pati entMovemen tMDWS.Room BedId);
  854                         Assert.Are Equal(pati entMovemen tVIA.Trans actionType Id, patien tMovementM DWS.Transa ctionTypeI d);
  855                         Assert.Are Equal(pati entMovemen tVIA.TypeO fMovementI d, patient MovementMD WS.TypeOfM ovementId) ;
  856                         Assert.Are Equal(pati entMovemen tVIA.WardL ocationId,  patientMo vementMDWS .WardLocat ionId);
  857                    }
  858                }
  859                catch (E xception e x)
  860                {
  861                    Asse rt.Fail(ex .ToString( ));
  862                }
  863           }
  864  
  865           [T estMethod]
  866           pu blic void  TestGetPat ientMoveme ntByDateRa nge()
  867           {
  868                DateTime  startDate  = new Dat eTime(2018 , 1, 26);
  869                DateTime  endDate =  new DateT ime(2018,  1, 26, 23,  59, 59);
  870  
  871                try
  872                {
  873                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  874                    ILis t<PatientM ovement> p atientMove mentsVIA =  viaQuery. GetPatient Movements( startDate,  endDate);
  875  
  876                    Asse rt.IsNotNu ll(patient MovementsV IA);
  877  
  878                    if ( _compareTo MDWS)
  879                    {
  880                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  881                         IList<Pati entMovemen t> patient MovementsM DWS = mdws Query.GetP atientMove ments(star tDate, end Date);
  882  
  883                         Assert.IsN otNull(pat ientMoveme ntsMDWS);
  884  
  885                         Assert.Are Equal(pati entMovemen tsVIA.Coun t, patient MovementsM DWS.Count) ;
  886  
  887                         // Check f ields have  expected  values and  match bet ween VIA/M DWS
  888                         Assert.Are Equal(pati entMovemen tsVIA[0].I EN, patien tMovements MDWS[0].IE N);
  889                         Assert.Are Equal(pati entMovemen tsVIA[0].D ateTime, p atientMove mentsMDWS[ 0].DateTim e);
  890                         Assert.Are Equal(pati entMovemen tsVIA[0].E nteredById , patientM ovementsMD WS[0].Ente redById);
  891                         Assert.Are Equal(pati entMovemen tsVIA[0].P atientId,  patientMov ementsMDWS [0].Patien tId);
  892                         Assert.Are Equal(pati entMovemen tsVIA[0].C urrentAdmi ssionIen,  patientMov ementsMDWS [0].Curren tAdmission Ien);
  893                         Assert.Are Equal(pati entMovemen tsVIA[0].E nteredById , patientM ovementsMD WS[0].Ente redById);
  894                         Assert.Are Equal(pati entMovemen tsVIA[0].R oomBedId,  patientMov ementsMDWS [0].RoomBe dId);
  895                         Assert.Are Equal(pati entMovemen tsVIA[0].T ransaction TypeId, pa tientMovem entsMDWS[0 ].Transact ionTypeId) ;
  896                         Assert.Are Equal(pati entMovemen tsVIA[0].T ypeOfMovem entId, pat ientMoveme ntsMDWS[0] .TypeOfMov ementId);
  897                         Assert.Are Equal(pati entMovemen tsVIA[0].W ardLocatio nId, patie ntMovement sMDWS[0].W ardLocatio nId);
  898                    }
  899                }
  900                catch (E xception e x)
  901                {
  902                    Asse rt.Fail(ex .ToString( ));
  903                }
  904           }
  905  
  906           [T estMethod]
  907           pu blic void  TestGetPat ientMoveme ntIENs()
  908           {
  909                DateTime  startDate  = new Dat eTime(2018 , 1, 26);
  910                DateTime  endDate =  new DateT ime(2018,  1, 30, 23,  59, 59);
  911  
  912                try
  913                {
  914                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  915                    ILis t<PatientM ovementIen > patientM ovementIen sVIA = via Query.GetP atientMove mentIens(s tartDate,  endDate);
  916  
  917                    Asse rt.IsNotNu ll(patient MovementIe nsVIA);
  918  
  919                    if ( _compareTo MDWS)
  920                    {
  921                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  922                         IList<Pati entMovemen tIen> pati entMovemen tIensMDWS  = mdwsQuer y.GetPatie ntMovement Iens(start Date, endD ate);
  923  
  924                         Assert.IsN otNull(pat ientMoveme ntIensMDWS );
  925  
  926                         // MDWS re turns extr a results.  VIA retur ns correct  number
  927                         //Assert.A reEqual(pa tientMovem entIensVIA .Count, pa tientMovem entIensMDW S.Count);
  928  
  929                         // check f ields have  expected  values and  match bet ween VIA/M DWS
  930                         Assert.Are Equal(pati entMovemen tIensVIA[0 ].IEN, pat ientMoveme ntIensMDWS [0].IEN);
  931                         Assert.Are Equal(pati entMovemen tIensVIA[0 ].PatientI en, patien tMovementI ensMDWS[0] .PatientIe n);
  932                         Assert.Are Equal(pati entMovemen tIensVIA[0 ].CurrentA dmissionIe n, patient MovementIe nsMDWS[0]. CurrentAdm issionIen) ;
  933                         Assert.Are Equal(pati entMovemen tIensVIA[0 ].EnteredD ate, patie ntMovement IensMDWS[0 ].EnteredD ate);
  934                         Assert.Are Equal(pati entMovemen tIensVIA[0 ].Movement Date, pati entMovemen tIensMDWS[ 0].Movemen tDate);
  935                         Assert.Are Equal(pati entMovemen tIensVIA[0 ].RoomBedI d, patient MovementIe nsMDWS[0]. RoomBedId) ;
  936                         Assert.Are Equal(pati entMovemen tIensVIA[0 ].Transact ionTypeId,  patientMo vementIens MDWS[0].Tr ansactionT ypeId);
  937                         Assert.Are Equal(pati entMovemen tIensVIA[0 ].TypeOfMo vementIen,  patientMo vementIens MDWS[0].Ty peOfMoveme ntIen);
  938                         Assert.Are Equal(pati entMovemen tIensVIA[0 ].WardLoca tionId, pa tientMovem entIensMDW S[0].WardL ocationId) ;
  939                    }
  940                }
  941                catch (E xception e x)
  942                {
  943                    Asse rt.Fail(ex .ToString( ));
  944                }
  945           }
  946  
  947           // [TestMetho d]  // not  implement ed excepti on
  948           pu blic void  TestGetPat ientMoveme ntByAdmiss ion()
  949           {
  950                try
  951                {
  952                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  953                    ILis t<PatientM ovement> p atientMove mentsVIA =  viaQuery. GetPatient MovementsF orAdmissio n(_sitePar ams.Admiss ionIEN);
  954  
  955                    Asse rt.IsNotNu ll(patient MovementsV IA);
  956  
  957                    if ( _compareTo MDWS)
  958                    {
  959                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  960                         IList<Pati entMovemen t> patient MovementsM DWS = mdws Query.GetP atientMove mentsForAd mission(_s iteParams. AdmissionI EN);
  961  
  962                         Assert.IsN otNull(pat ientMoveme ntsMDWS);
  963  
  964                         Assert.Are Equal(pati entMovemen tsVIA.Coun t, patient MovementsM DWS.Count) ;
  965  
  966                         // Check f ields have  expected  values and  match bet ween VIA/M DWS
  967                         Assert.Are Equal(pati entMovemen tsVIA[0].I EN, patien tMovements MDWS[0].IE N);
  968                         Assert.Are Equal(pati entMovemen tsVIA[0].D ateTime, p atientMove mentsMDWS[ 0].DateTim e);
  969                         Assert.Are Equal(pati entMovemen tsVIA[0].E nteredById , patientM ovementsMD WS[0].Ente redById);
  970                         Assert.Are Equal(pati entMovemen tsVIA[0].P atientId,  patientMov ementsMDWS [0].Patien tId);
  971                         Assert.Are Equal(pati entMovemen tsVIA[0].C urrentAdmi ssionIen,  patientMov ementsMDWS [0].Curren tAdmission Ien);
  972                         Assert.Are Equal(pati entMovemen tsVIA[0].E nteredById , patientM ovementsMD WS[0].Ente redById);
  973                         Assert.Are Equal(pati entMovemen tsVIA[0].R oomBedId,  patientMov ementsMDWS [0].RoomBe dId);
  974                         Assert.Are Equal(pati entMovemen tsVIA[0].T ransaction TypeId, pa tientMovem entsMDWS[0 ].Transact ionTypeId) ;
  975                         Assert.Are Equal(pati entMovemen tsVIA[0].T ypeOfMovem entId, pat ientMoveme ntsMDWS[0] .TypeOfMov ementId);
  976                         Assert.Are Equal(pati entMovemen tsVIA[0].W ardLocatio nId, patie ntMovement sMDWS[0].W ardLocatio nId);
  977                    }
  978                }
  979                catch (E xception e x)
  980                {
  981                    Asse rt.Fail(ex .ToString( ));
  982                }
  983           }
  984  
  985           pr ivate void  TestListS cheduledAd missions(D ateTime? s tartDate =  null, Dat eTime? end Date = nul l, string  patientIEN  = null)
  986           {
  987                // "PATI EN","SDATE ","EDATE", "MAX","FRO M"
  988                // <crit eria>72008 76^3100510 ^3130520^^ </criteria >
  989                IVistAQu ery viaQue ry = Build VistAQuery (DataRetri evalMethod .VIA);
  990                IList<Sc heduledAdm ission> ca llVIA = vi aQuery.Get ScheduledA dmissions( startDate,  endDate,  patientIEN );
  991                Assert.I sNotNull(c allVIA);
  992  
  993                if (_com pareToMDWS )
  994                {
  995                    IVis tAQuery md wsQuery =  BuildVistA Query(Data RetrievalM ethod.MDWS );
  996                    ILis t<Schedule dAdmission > callMDWS  = mdwsQue ry.GetSche duledAdmis sions(star tDate, end Date, pati entIEN);
  997  
  998                    Asse rt.IsNotNu ll(callMDW S);
  999  
  1000                    Asse rt.AreEqua l(callVIA. Count, cal lMDWS.Coun t);
  1001                }
  1002  
  1003                // TODO  - check fi elds have  expected v alues and  match betw een VIA/MD WS
  1004           }
  1005  
  1006           [T estMethod]
  1007           pu blic void  TestListSc heduledAdm issionsByS tartDate()
  1008           {
  1009                try
  1010                {
  1011                    Date Time start Date = new  DateTime( 2010, 5, 1 0); // TOD O - get da te
  1012  
  1013                    Test ListSchedu ledAdmissi ons(startD ate);
  1014                }
  1015                catch (E xception e x)
  1016                {
  1017                    Asse rt.Fail(ex .ToString( ));
  1018                }
  1019           }
  1020  
  1021           [T estMethod]
  1022           pu blic void  TestListSc heduledAdm issionsByD ateRange()
  1023           {
  1024                try
  1025                {
  1026                    Date Time start Date = new  DateTime( 2016, 01,  01);
  1027                    Date Time endDa te = new D ateTime(20 16, 01, 31 , 23, 59,  59);
  1028  
  1029                    Test ListSchedu ledAdmissi ons(startD ate, endDa te);
  1030                }
  1031                catch (E xception e x)
  1032                {
  1033                    Asse rt.Fail(ex .ToString( ));
  1034                }
  1035           }
  1036  
  1037           [T estMethod]
  1038           pu blic void  TestListSc heduledAdm issionsByP atientIEN( )
  1039           {
  1040                try
  1041                {
  1042                    Test ListSchedu ledAdmissi ons(null,  null, _sit eParams.Pa tientIEN);
  1043                }
  1044                catch (E xception e x)
  1045                {
  1046                    Asse rt.Fail(ex .ToString( ));
  1047                }
  1048           }
  1049  
  1050           pr ivate void  TestListP atientAppo intments(D ateTime? s tartDate,  DateTime?  endDate, s tring pati entIEN, IE numerable< string> cl inics)
  1051           {
  1052                try
  1053                {
  1054                    // " IENSB","MA X","SDATE" ,"EDATE"," CLNIEN","F ROM"
  1055                    // < criteria>7 208163^^31 01206^3101 206^1690^< /criteria>
  1056                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  1057                    Date Time befor eVIA = Dat eTime.Now;
  1058                    ILis t<PatientA ppointment > callVIA  = viaQuery .GetPatien tAppointme nts(startD ate, endDa te, patien tIEN, clin ics);
  1059                    Date Time after VIA = Date Time.Now;
  1060                    Time Span durat ionVIA = a fterVIA -  beforeVIA;
  1061  
  1062                    Asse rt.IsNotNu ll(callVIA );
  1063  
  1064                    if ( _compareTo MDWS)
  1065                    {
  1066                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  1067                         IList<Pati entAppoint ment> call MDWS = mdw sQuery.Get PatientApp ointments( startDate,  endDate,  patientIEN , clinics) ;
  1068  
  1069                         Assert.IsN otNull(cal lMDWS);
  1070  
  1071                         Assert.Are Equal(call VIA.Count,  callMDWS. Count);
  1072                    }
  1073  
  1074                    // T ODO - chec k fields h ave expect ed values  and match  between VI A/MDWS
  1075                }
  1076                catch (E xception e x)
  1077                {
  1078                    Asse rt.Fail(ex .ToString( ));
  1079                }
  1080           }
  1081  
  1082           [T estMethod]
  1083           pu blic void  TestListPa tientAppoi ntmentBySt artDate()
  1084           {
  1085                try
  1086                {
  1087                    Date Time start Date = new  DateTime( 2010, 12,  6);
  1088                    IEnu merable<st ring> clin ics = new[ ] { "1690"  };
  1089  
  1090                    Test ListPatien tAppointme nts(startD ate, null,  null, cli nics);
  1091                }
  1092                catch (E xception e x)
  1093                {
  1094                    Asse rt.Fail(ex .ToString( ));
  1095                }
  1096           }
  1097  
  1098           [T estMethod]
  1099           pu blic void  TestListPa tientAppoi ntmentByPa tient()
  1100           {
  1101                try
  1102                {
  1103                    Test ListPatien tAppointme nts(_siteP arams.list PatientSta rtDate, _s iteParams. listPatien tEndDate,  "7207908",  null);
  1104                }
  1105                catch (E xception e x)
  1106                {
  1107                    Asse rt.Fail(ex .ToString( ));
  1108                }
  1109           }
  1110  
  1111           [T estMethod]
  1112           pu blic void  TestListPa tientAppoi ntmentByDa teRange()
  1113           {
  1114                try
  1115                {
  1116                    Test ListPatien tAppointme nts(_siteP arams.list PatientSta rtDate, _s iteParams. listPatien tEndDate,  null, _sit eParams.li stPatientC linics);
  1117                }
  1118                catch (E xception e x)
  1119                {
  1120                    Asse rt.Fail(ex .ToString( ));
  1121                }
  1122           }
  1123  
  1124           [T estMethod]
  1125           pu blic void  TestBulkCa ncelOrders ()
  1126           {
  1127                try
  1128                {
  1129                    Stri ngBuilder  sb = new S tringBuild er();
  1130                    int  limit = 30 ;
  1131                    int  cnt = 0;
  1132                    fore ach (strin g line in  File.ReadL ines("nati onal-list. csv"))
  1133                    {
  1134                         string[] s ite = line .Split(',' );
  1135                         if (!site[ 2].StartsW ith("10N") )
  1136                         {
  1137                               _vistaSite  = new Vis tASite("te st", "VI"  + site[1],  site[2],  TimeZoneIn fo.Local,  "http:// DNS /QuerySvc. asmx");
  1138                             BuildP aramsForCh eyl19();
  1139                             IVistA Query viaQ uery = Bui ldVistAQue ry(DataRet rievalMeth od.VIA);
  1140                             IList< string> ca llVIA = vi aQuery.Get CanceledOr ders(_site Params.Can celedOrder sIENs);
  1141                             sb.App end(DateTi me.Now + "  ***** " +  site[1] +  " : " + s ite[2] + "  : " + sit e[5] + " "  + site[6]  + " " + s ite[7]);
  1142                             sb.App endLine();
  1143                             for (i nt i=0; i< callVIA.Co unt; i++)  {
  1144                                 sb .Append(ca llVIA[i]);
  1145                                 sb .AppendLin e();
  1146                             }
  1147                             cnt++;
  1148                             if (cn t > limit)
  1149                             {
  1150                                 br eak;
  1151                             }
  1152                             //Syst em.Threadi ng.Thread. Sleep(1000 );
  1153                         }
  1154                    }
  1155                    usin g (StreamW riter writ er = new S treamWrite r("cancelo rder.txt") )
  1156                    {
  1157                         writer.Wri te(sb.ToSt ring());
  1158                    }
  1159                }
  1160                catch (E xception e x)
  1161                {
  1162                    Asse rt.Fail(ex .ToString( ));
  1163                }
  1164           }
  1165  
  1166           [T estMethod]
  1167           pu blic void  TestListCa ncelOrders ()
  1168           {
  1169                //  does n't return  all the d ata
  1170                try
  1171                {
  1172                    // " IENSM"
  1173                    // < criteria>5 587620</cr iteria>
  1174                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  1175                    ILis t<string>  callVIA =  viaQuery.G etCanceled Orders(_si teParams.C anceledOrd ersIENs);
  1176  
  1177                    Asse rt.IsNotNu ll(callVIA );
  1178  
  1179                    if ( _compareTo MDWS)
  1180                    {
  1181                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  1182                         IList<stri ng> orders MDWS = mdw sQuery.Get CanceledOr ders(_site Params.Can celedOrder sIENs);
  1183  
  1184                         Assert.IsN otNull(ord ersMDWS);
  1185  
  1186                         Assert.Are Equal(call VIA.Count,  ordersMDW S.Count);
  1187                    }
  1188  
  1189                    // T ODO - chec k fields h ave expect ed values  and match  between VI A/MDWS
  1190                }
  1191                catch (E xception e x)
  1192                {
  1193                    Asse rt.Fail(ex .ToString( ));
  1194                }
  1195           }
  1196  
  1197           [T estMethod]
  1198           pu blic void  TestListRo omBed()
  1199           {
  1200                try
  1201                {
  1202                    // " IENSM","FR OM","MAX"
  1203                    // < criteria>^ ^1000</cri teria>
  1204                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  1205                    ILis t<RoomBed>  callVIA =  viaQuery. GetRoomBed s();
  1206  
  1207                    Asse rt.IsNotNu ll(callVIA );
  1208  
  1209                    if ( _compareTo MDWS)
  1210                    {
  1211                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  1212                         IList<Room Bed> callM DWS = mdws Query.GetR oomBeds();
  1213  
  1214                         Assert.IsN otNull(cal lMDWS);
  1215  
  1216                         Assert.Are Equal(call VIA.Count,  callMDWS. Count);
  1217                    }
  1218  
  1219                    // T ODO - chec k fields h ave expect ed values  and match  between VI A/MDWS
  1220                }
  1221                catch (E xception e x)
  1222                {
  1223                    Asse rt.Fail(ex .ToString( ));
  1224                }
  1225           }
  1226  
  1227           // [TestMetho d]
  1228           pu blic void  TestListCl inicAppoin tments()
  1229           {
  1230                // NOTE:  This is n ot impleme nted speci fically in  any IVist AQuery. Th is is call ed by GetP atientAppo intments,  so this te st is some what redun dant.
  1231                // There  is no MDW S command  for it.
  1232  
  1233                throw ne w NotImple mentedExce ption();
  1234           }
  1235  
  1236           [T estMethod]
  1237           pu blic void  TestListOr ders()
  1238           {
  1239                DateTime  startDate  = _sitePa rams.listO rderStartD ate;
  1240                DateTime  endDate =  _sitePara ms.listOrd erEndDate;
  1241  
  1242                ViaVistA Query viaQ uery = Bui ldVistAQue ry(DataRet rievalMeth od.VIA) as  ViaVistAQ uery;
  1243  
  1244                DateTime  beforeVIA  = DateTim e.Now;
  1245  
  1246                List<Ord er> orders  = viaQuer y.GetResul ts(new Lis tOrdersCom mand(viaQu ery)
  1247                {
  1248                    Star tDate = st artDate,
  1249                    EndD ate = endD ate,
  1250                    Orde rableItemI ens = _sit eParams.or derableIte ms,
  1251                    Pati entIen = n ull,
  1252                    IsAn ticipated  = false,
  1253                });
  1254  
  1255                DateTime  afterVIA  = DateTime .Now;
  1256                TimeSpan  durationV IA = after VIA - befo reVIA;
  1257  
  1258                foreach  (Order o i n orders)
  1259                {
  1260                    if ( o.OrderOrd erableItem Ids.Count( ) > 1)
  1261                    {
  1262                         int j = 0;
  1263                    }
  1264                }
  1265  
  1266                Assert.I sNotNull(o rders);
  1267           }
  1268  
  1269           [T estMethod]
  1270           pu blic void  TestListOr derActions ()
  1271           {
  1272                try
  1273                {
  1274                    // m ain use ca se has nul l patient  IEN
  1275  
  1276                    Date Time start Date = new  DateTime( 2006, 1, 2 3);
  1277                    Date Time endDa te = new D ateTime(20 06, 1, 28,  23, 59, 5 9);
  1278  
  1279                    IEnu merable<st ring> orde rIENs = ne w[] { "73" , "75", "7 6", "18005 ", "18003" , "14795",  "13974",  "13975", " 14215", "1 4214" };
  1280                    // " ORDIEN","I ENSB","SDA TE","EDATE ","VALUE", "MAX","FRO M"
  1281                    // < criteria>7 3,75,76,36 0,740^1336 650^302022 0^3020220^ 1^^</crite ria>
  1282                    IVis tAQuery vi aQuery = B uildVistAQ uery(DataR etrievalMe thod.VIA);
  1283                    ILis t<OrderAct ion> callV IA = viaQu ery.GetOrd erActions( startDate,  endDate,  null, orde rIENs);
  1284  
  1285                    Asse rt.IsNotNu ll(callVIA );
  1286  
  1287                    if ( _compareTo MDWS)
  1288                    {
  1289                         IVistAQuer y mdwsQuer y = BuildV istAQuery( DataRetrie valMethod. MDWS);
  1290                         IList<Orde rAction> c allMDWS =  mdwsQuery. GetOrderAc tions(star tDate, end Date, null , orderIEN s);
  1291  
  1292                         Assert.IsN otNull(cal lMDWS);
  1293  
  1294                         Assert.Are Equal(call VIA.Count,  callMDWS. Count);
  1295                    }
  1296  
  1297                    // T ODO - chec k fields h ave expect ed values  and match  between VI A/MDWS
  1298                }
  1299                catch (E xception e x)
  1300                {
  1301                    Asse rt.Fail(ex .ToString( ));
  1302                }
  1303           }
  1304       }
  1305   }