59. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 4/7/2019 7:13:56 PM Eastern 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.

59.1 Files compared

# Location File Last Modified
1 MHLTH_CLOZ_MOD _SRC.zip\MHLTH_CLOZ_MOD _SRC\Releases\ClozMod_Build5_.zip\Va.Gov.Nccc.Registry.Tests\FacilityManagement FacilityManagementControllerTest.cs Mon Mar 4 20:33:52 2019 UTC
2 MHLTH_CLOZ_MOD _SRC.zip\MHLTH_CLOZ_MOD _SRC\Releases\ClozMod_Build5_.zip\Va.Gov.Nccc.Registry.Tests\FacilityManagement FacilityManagementControllerTest.cs Thu Apr 4 19:05:28 2019 UTC

59.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 9 740
Changed 8 16
Inserted 0 0
Removed 0 0

59.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

59.4 Active regular expressions

No regular expressions were active.

59.5 Comparison detail

  1   using Micr osoft.Visu alStudio.T estTools.U nitTesting ;
  2   using Va.G ov.Nccc.Re gistry.Con trollers;
  3   using Va.G ov.Nccc.Re gistry.Mod els.Home;
  4   using Va.G ov.Nccc.Da ta.Common. Repository ;
  5   using Va.G ov.Nccc.Da ta.Common. FacilityRe gistryUser s;
  6   using Moq;
  7   using Va.G ov.Nccc.Da ta.Common. RegistryUs ers;
  8   using Syst em.Threadi ng.Tasks;
  9   using Va.G ov.Nccc.Da ta.Common. Results;
  10   using Syst em.Collect ions.Gener ic;
  11   using Syst em.Web.Mvc ;
  12   using Va.G ov.Nccc.Da ta.Common. PhoneNumbe rs;
  13   using Va.G ov.Nccc.Da ta.Common. Facilities ;
  14   using Va.G ov.Nccc.Da ta.Common;
  15   using Va.G ov.Nccc.Da ta.Common. Roles;
  16   using Syst em.Compone ntModel;
  17  
  18   namespace  Va.Gov.Ncc c.Registry .Tests.Fac ilityManag ement
  19   {
  20       [TestC lass]
  21       public  class Fac ilityManag ementContr ollerTest
  22       {
  23           Fa cilityMana gementCont roller con trollerSys temUnderTe st;
  24           Lo ginViewMod el modelTo BePassedTo SystemUnde rTest;
  25           Mo ck<IReposi tory> mock NcccReposi tory;
  26           Mo ck<IFacili tyRegistry UsersRepos itory> moc kIFacility RegistryUs ersReposit ory;
  27           Mo ck<IRegist ryUsersRep ository> m ockIRegist ryUsersRep ository;
  28           Mo ck<IFacili tiesReposi tory> mock IFacilityR epository;
  29           Mo ck<IRolesR epository>  mockIRole sRepositor y;
  30  
  31  
  32           [T estInitial ize]
  33           pu blic void  TestMethod 1()
  34           {
  35                // Mock  out our us er reposit ory (a fak e concrete  instance)
  36                mockIFac ilityRegis tryUsersRe pository =  new Mock< IFacilityR egistryUse rsReposito ry>(MockBe havior.Loo se);
  37                mockIReg istryUsers Repository  = new Moc k<IRegistr yUsersRepo sitory>(Mo ckBehavior .Loose);
  38                mockIFac ilityRepos itory = ne w Mock<IFa cilitiesRe pository>( MockBehavi or.Loose);
  39                mockIRol esReposito ry = new M ock<IRoles Repository >(MockBeha vior.Loose );
  40  
  41                // Mock  out our la rger repos itory (tha t collects  all the r epositorie s)
  42                mockNccc Repository  = new Moc k<IReposit ory>(MockB ehavior.Lo ose);
  43  
  44                // Set u p the meth od for the  larger re pository t hat calls  the smalle r reposito ry
  45                mockNccc Repository .Setup(p = > p.Facili tyRegistry Users).Ret urns(mockI FacilityRe gistryUser sRepositor y.Object);
  46                mockNccc Repository .Setup(p = > p.Users) .Returns(m ockIRegist ryUsersRep ository.Ob ject);
  47                mockNccc Repository .Setup(p = > p.Facili ties).Retu rns(mockIF acilityRep ository.Ob ject);
  48                mockNccc Repository .Setup(p = > p.Roles) .Returns(m ockIRolesR epository. Object);
  49  
  50  
  51                // Creat e a concre te instanc e of the s ystem we w ill be tes ting
  52                controll erSystemUn derTest =  new Facili tyManageme ntControll er(mockNcc cRepositor y.Object);
  53  
  54                // Pass  a concrete  ViewModel  to the co ntroller
  55                modelToB ePassedToS ystemUnder Test = new  LoginView Model();
  56           }
  57           [T estMethod( )]
  58           pu blic async  Task Inde xSuccess()
  59           {
  60                //Setup
  61                mockIReg istryUsers Repository .Setup(p = > p.ReadAj axAdmin(1,  8, string .Empty, "S uper Admin istrator") ).ReturnsA sync(new P agedListRe sult<Regis tryUser>
  62                {
  63                    List  = new Lis t<Registry User>
  64                    {
  65                          new Regist ryUser {    UserName =  "UserName ", EmailAd dress = " PII             ",
  66                              Regis tryUserNam e = new Da ta.Common. PersonName  { First=" First Test ",Last="La st Test"},
  67                         },
  68                          new Regist ryUser { U serName =  "UserName2 ", EmailAd dress = " PII               ",
  69                             PhoneN umber= new  PhoneNumb er { Numbe r ="932-00 0-0000" },
  70                             Regist ryUserName  = new Dat a.Common.P ersonName  { First="F irst Test2 ",Last="La st Test2"} , },
  71                    },
  72                    Succ ess = true
  73                });
  74  
  75                //Action
  76                ActionRe sult resul t = await  controller SystemUnde rTest.Inde x();
  77  
  78                Redirect ToRouteRes ult redire ctResult =  result as  RedirectT oRouteResu lt;
  79  
  80                //Assert
  81                Assert.I sNotNull(r esult);
  82                Assert.I sInstanceO fType(resu lt, typeof (ViewResul t));
  83           }
  84  
  85           [T estMethod( )]
  86           pu blic async  Task Load Facilities Admin_Dele te_Success ()
  87           {
  88             
  89                mockIFac ilityRegis tryUsersRe pository.S etup(p =>  p.Removead ministrato r(It.IsAny <int>(), I t.IsAny<in t>())).Ret urnsAsync( new ItemRe sult<Facil ityRegistr yUser>
  90                {
  91                    Succ ess = true ,
  92                    Item  = null,
  93  
  94                });
  95  
  96  
  97                //loadin g facility  admin
  98                mockIFac ilityRepos itory.Setu p(p => p.R eadAsync(I t.IsAny<in t>())).Ret urnsAsync( new ItemRe sult<Facil ity>
  99                {
  100                    Succ ess = true ,
  101                    Item  = new Fac ility
  102                    {
  103                         Id = 2,
  104                         Parent = n ew Facilit y
  105                         {
  106                             Id = 2 ,
  107                             Statio nName = "t est",
  108                             Statio nNumber =  900,
  109                             ShortN ame = "tes t12",
  110                             Addres s = new Ad dress { Ci ty = "city ", State =  "tx", Zip Code = "75 094", Line 1 = "l1",  Line2 = "l 2" },
  111                             Region  = "region ",
  112  
  113                         },
  114                         Address =  new Addres s { City =  "city", S tate = "tx ", ZipCode  = "75094" , Line1 =  "l1", Line 2 = "l2" } ,
  115                         StationNam e = "test" ,
  116                         StationNum ber = 900,
  117                    }
  118  
  119                });
  120  
  121                mockIFac ilityRegis tryUsersRe pository.S etup(p =>  p.ReadAllU sers(1)).R eturns(new  ListResul t<Facility RegistryUs er>
  122                {
  123                    List  = new Lis t<Facility RegistryUs er>
  124                    {
  125                          new Facil ityRegistr yUser {
  126                             Regist ryUserId = 1, Facilit y = new Da ta.Common. Facilities .Facility  { Id = 1,
  127                              Addre ss = new A ddress { C ity = "cit y", State  = "tx", Zi pCode = "7 5094", Lin e1 = "l1",  Line2 = " l2" },
  128                             Parent  = new Fac ility { Id  = 1 }, St ationName  = "test",  StationNum ber = 900  },
  129                             Regist ryUser = n ew Registr yUser
  130                                 { EmailAdd ress = " PII             ", PhoneNu mber = new  PhoneNumb er { Numbe r = "972-0 00-0000" } ,
  131                                 Re gistryUser Name = new  PersonNam e { First  = "First T est", Last  = "Last T est" },
  132                                 Id =1,  Activ e=true
  133                             }
  134                          }
  135                          ,
  136                    },
  137                    Succ ess = true
  138                });
  139  
  140                //Action
  141                ActionRe sult resul t = await  controller SystemUnde rTest.Load Facilities Admin(1, 0 , 1);
  142                Redirect ToRouteRes ult redire ctResult =  result as  RedirectT oRouteResu lt;
  143  
  144                //Assert
  145                Assert.I sNotNull(r esult);
  146                Assert.I sInstanceO fType(resu lt, typeof (ActionRes ult));
  147  
  148           }
  149  
  150  
  151           [T estMethod( )]
  152           pu blic async  Task Load Facilities Admin_Dele te_Fail()
  153           {
  154                mockIFac ilityRegis tryUsersRe pository.S etup(p =>  p.Removead ministrato r(It.IsAny <int>(), I t.IsAny<in t>())).Ret urnsAsync( new ItemRe sult<Facil ityRegistr yUser>
  155                {
  156                    Succ ess = fals e,
  157                    Item  = null,
  158  
  159                });
  160  
  161                //loadin g facility  admin
  162                mockIFac ilityRepos itory.Setu p(p => p.R eadAsync(I t.IsAny<in t>())).Ret urnsAsync( new ItemRe sult<Facil ity>
  163                {
  164                    Succ ess = true ,
  165                    Item  = new Fac ility
  166                    {
  167                         Id = 2,
  168                         Parent = n ew Facilit y
  169                         {
  170                             Id = 2 , StationN ame = "tes t", Statio nNumber =  900, Short Name = "te st12",
  171                             Addres s = new Ad dress { Ci ty = "city ", State =  "tx", Zip Code = "75 094", Line 1 = "l1",  Line2 = "l 2" },
  172                             Region  = "region ",
  173  
  174                         },
  175                         Address =  new Addres s { City =  "city", S tate = "tx ", ZipCode  = "75094" , Line1 =  "l1", Line 2 = "l2" } ,
  176                         StationNam e = "test" ,   Statio nNumber =  900,
  177                    }
  178  
  179                });
  180  
  181                mockIFac ilityRegis tryUsersRe pository.S etup(p =>  p.ReadAllU sers(1)).R eturns(new  ListResul t<Facility RegistryUs er>
  182                {
  183                    List  = new Lis t<Facility RegistryUs er>
  184                    {
  185                          new Facil ityRegistr yUser {
  186                             Regist ryUserId = 1, Facilit y = new Da ta.Common. Facilities .Facility  { Id = 1,
  187                              Addre ss = new A ddress { C ity = "cit y", State  = "tx", Zi pCode = "7 5094", Lin e1 = "l1",  Line2 = " l2" },
  188                             Parent  = new Fac ility { Id  = 1 }, St ationName  = "test",  StationNum ber = 900  },
  189                             Regist ryUser = n ew Registr yUser
  190                                 { EmailAdd ress = " PII             ",      PhoneNumbe r = new Ph oneNumber  { Number =  "972-000- 0000" },
  191                                 Re gistryUser Name = new  PersonNam e { First  = "First T est", Last  = "Last T est" },  I d=1,  Acti ve=true
  192                             }
  193                          }
  194                          ,
  195                    },
  196                    Succ ess = true
  197                });
  198  
  199                //Action
  200                ActionRe sult resul t = await  controller SystemUnde rTest.Load Facilities Admin(1, 0 , 1);
  201                Redirect ToRouteRes ult redire ctResult =  result as  RedirectT oRouteResu lt;
  202  
  203                //Assert
  204                Assert.I sNotNull(r esult);
  205                Assert.I sInstanceO fType(resu lt, typeof (ActionRes ult));
  206  
  207           }
  208  
  209           [T estMethod( )]
  210           pu blic async  Task Load Facilities AdminSucce ss()
  211           {
  212                //loadin g facility  admin
  213                mockIFac ilityRepos itory.Setu p(p => p.R eadAsync(I t.IsAny<in t>())).Ret urnsAsync( new ItemRe sult<Facil ity>
  214                {
  215                    Succ ess = true ,
  216                    Item  = new Fac ility
  217                    {
  218                         Id = 2,
  219                         Parent = n ew Facilit y
  220                         {
  221                             Id = 2 , StationN ame = "tes t",  Stati onNumber =  900, Shor tName = "t est12",
  222                             Addres s = new Ad dress { Ci ty = "city ", State =  "tx", Zip Code = "75 094", Line 1 = "l1",  Line2 = "l 2" },
  223                             Region  = "region ",                         
  224                         },
  225                         Address =  new Addres s { City =  "city", S tate = "tx ", ZipCode  = "75094" , Line1 =  "l1", Line 2 = "l2" } ,
  226                         StationNam e = "test" ,  Station Number = 9 00,
  227                    }
  228  
  229                });
  230  
  231                mockIFac ilityRegis tryUsersRe pository.S etup(p =>  p.ReadAllU sers(1)).R eturns(new  ListResul t<Facility RegistryUs er>
  232                {
  233                    List  = new Lis t<Facility RegistryUs er>
  234                    {
  235                          new Facil ityRegistr yUser {
  236                             Regist ryUserId=1 , Facility  = new Fac ility { Id  = 1,
  237                             Addres s = new Ad dress { Ci ty = "city ", State =  "tx", Zip Code = "75 094", Line 1 = "l1",  Line2 = "l 2" },
  238                             Parent  = new Fac ility { Id  = 1 }, St ationName  = "test",  StationNum ber = 900  },
  239                              Regis tryUser =  new Regist ryUser
  240                                 EmailAddre ss = " PII             ",    PhoneNumbe r = new Ph oneNumber  { Number =  "972-000- 0000" },
  241                                 Re gistryUser Name = new  PersonNam e { First  = "First T est", Last  = "Last T est" },  I d=1,    Ac tive=true
  242                             }
  243                          }
  244                          ,
  245                    },
  246                    Succ ess = true
  247                });
  248  
  249                mockIFac ilityRegis tryUsersRe pository.S etup(p =>  p.Createad min(1, 1)) .ReturnsAs ync(new It emResult<F acilityReg istryUser>
  250                {
  251                    Item  = new Fac ilityRegis tryUser
  252                    {
  253                          RegistryU serId = 1,
  254                         Facility =  new Facil ity
  255                         {
  256                             Id = 1 , Parent =  new Facil ity { Id =  1 }, Stat ionName =  "test", St ationNumbe r = 900,
  257                             Addres s = new Ad dress { Ci ty = "city ", State =  "tx", Zip Code = "75 094", Line 1 = "l1",  Line2 = "l 2" },
  258                         },
  259                         RegistryUs er = new R egistryUse r
  260                         {
  261                               EmailAddre ss = " PII             ", PhoneNu mber = new  PhoneNumb er { Numbe r = "972-0 00-0000" } ,
  262                             Regist ryUserName  = new Per sonName {  First = "F irst Test" , Last = " Last Test"  },
  263                         },
  264  
  265                    },
  266                    Succ ess = true
  267                });
  268  
  269                //Action
  270                ActionRe sult resul t = await  controller SystemUnde rTest.Load Facilities Admin(1, 1 , 0);
  271                Redirect ToRouteRes ult redire ctResult =  result as  RedirectT oRouteResu lt;
  272  
  273                //Assert
  274                Assert.I sNotNull(r esult);
  275                Assert.I sInstanceO fType(resu lt, typeof (ActionRes ult));
  276  
  277           }
  278  
  279           pu blic async  Task Load Facilities Admin_Fail ()
  280           {
  281                //loadin g facility  admin
  282                mockIFac ilityRepos itory.Setu p(p => p.R eadAsync(I t.IsAny<in t>())).Ret urnsAsync( new ItemRe sult<Facil ity>
  283                {
  284                    Succ ess = fals e,
  285                    Item  = new Fac ility
  286                    {
  287                         Id = 2,
  288                         Parent = n ew Facilit y
  289                         {
  290                             Id = 2 , StationN ame = "tes t",  Stati onNumber =  900, Shor tName = "t est12",
  291                             Addres s = new Ad dress { Ci ty = "city ", State =  "tx", Zip Code = "75 094", Line 1 = "l1",  Line2 = "l 2" },
  292                             Region  = "region ",
  293                         },
  294                         Address =  new Addres s { City =  "city", S tate = "tx ", ZipCode  = "75094" , Line1 =  "l1", Line 2 = "l2" } ,
  295                         StationNam e = "test" ,   Statio nNumber =  900,
  296                    }
  297  
  298                });
  299  
  300                mockIFac ilityRegis tryUsersRe pository.S etup(p =>  p.ReadAllU sers(1)).R eturns(new  ListResul t<Facility RegistryUs er>
  301                {
  302                    List  = new Lis t<Facility RegistryUs er>
  303                    {
  304                          new Facil ityRegistr yUser {
  305                             Regist ryUserId = 1, Facilit y = new Fa cility { I d = 1,
  306                             Addres s = new Ad dress { Ci ty = "city ", State =  "tx", Zip Code = "75 094", Line 1 = "l1",  Line2 = "l 2" },
  307                             Parent  = new Fac ility { Id  = 1 }, St ationName  = "test",  StationNum ber = 900  },
  308                             Regist ryUser = n ew Registr yUser
  309                                 EmailAddre ss = " PII             ",
  310                                 Ph oneNumber  = new Phon eNumber {  Number = " 972-000-00 00" },
  311                                 Re gistryUser Name = new  PersonNam e { First  = "First T est", Last  = "Last T est" },
  312                                 Id =1,  Activ e=true
  313                             }
  314                          }
  315                          ,
  316                    },
  317                    Succ ess = fals e
  318                });
  319  
  320                mockIFac ilityRegis tryUsersRe pository.S etup(p =>  p.Createad min(1, 1)) .ReturnsAs ync(new It emResult<F acilityReg istryUser>
  321                {
  322                    Item  = new Fac ilityRegis tryUser
  323                    {
  324                         RegistryUs erId = 1,
  325                         Facility =  new Facil ity
  326                         {
  327                             Id = 1 , Parent =  new Facil ity { Id =  1 }, Stat ionName =  "test", St ationNumbe r = 900,
  328                             Addres s = new Ad dress { Ci ty = "city ", State =  "tx", Zip Code = "75 094", Line 1 = "l1",  Line2 = "l 2" },
  329                         },
  330                         RegistryUs er = new R egistryUse r
  331                         {
  332                               EmailAddre ss = " PII             ",    PhoneNumbe r = new Ph oneNumber  { Number =  "972-000- 0000" },
  333                             Regist ryUserName  = new Per sonName {  First = "F irst Test" , Last = " Last Test"  },
  334                         },
  335  
  336                    },
  337                    Succ ess = fals e
  338                });
  339  
  340                //Action
  341                ActionRe sult resul t = await  controller SystemUnde rTest.Load Facilities Admin(1, 1 , 0);
  342                Redirect ToRouteRes ult redire ctResult =  result as  RedirectT oRouteResu lt;
  343  
  344                //Assert
  345                Assert.I sNotNull(r esult);
  346                Assert.I sInstanceO fType(resu lt, typeof (ActionRes ult));
  347  
  348           }
  349           [T estMethod( )]
  350           pu blic void  FacilityUs ersRoles()  {
  351                mockIRol esReposito ry.Setup(p  => p.Read FacilityRo les(true,I t.IsAny<in t>(), It.I sAny<int>( ), It.IsAn y<ListSort Direction> ())).Retur ns(new Pag edListResu lt<Role>
  352                {
  353                    List  = new Lis t<Role>
  354                    {
  355                         new Role {  Descripti on = "this  is a desc ription",  RoleName=" Administra tion",Id=1   },
  356                         new Role {  Descripti on = "this  is a desc ription",  RoleName=" Staff" , I d=2 },
  357                    },
  358                    Succ ess = true
  359  
  360                });
  361  
  362                //Action
  363                ActionRe sult resul t = contro llerSystem UnderTest. FacilityUs ersRoles(t rue, 15);
  364                Redirect ToRouteRes ult redire ctResult =  result as  RedirectT oRouteResu lt;
  365  
  366                //Assert
  367                Assert.I sNotNull(r esult);
  368                Assert.I sInstanceO fType(resu lt, typeof (ViewResul t));
  369  
  370  
  371  
  372           }
  373  
  374  
  375  
  376  
  377       }
  378   }