Produced by Araxis Merge on 8/29/2017 11:27:37 AM 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | REFDOC-devel-20170714.zip\NVCC\NVCC.WebUI.Tests\Controllers | UserControllerTests.cs | Fri Jul 14 21:26:48 2017 UTC |
| 2 | REFDOC-devel-20170714.zip\NVCC\NVCC.WebUI.Tests\Controllers | UserControllerTests.cs | Mon Aug 28 17:42:04 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 140 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| 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 |
No regular expressions were active.
| 1 | using Moq; | |
| 2 | using NUni t.Framewor k; | |
| 3 | using NVCC .WebUI.Con trollers; | |
| 4 | using NVCC .WebUI.Inf rastructur e; | |
| 5 | using NVCC .WebUI.Mod els; | |
| 6 | using Syst em.Web.Mvc ; | |
| 7 | ||
| 8 | namespace NVCC.WebUI .Tests.Con trollers | |
| 9 | { | |
| 10 | [TestF ixture] | |
| 11 | public class Use rControlle rTests | |
| 12 | { | |
| 13 | pr ivate Mock <IUserServ ice> _user ServiceMoc k; | |
| 14 | pr ivate User Controller _controll er; | |
| 15 | ||
| 16 | [S etUp] | |
| 17 | pu blic void TestSetUp( ) | |
| 18 | { | |
| 19 | _userSer viceMock = new Mock< IUserServi ce>(); | |
| 20 | ||
| 21 | _control ler = new UserContro ller(_user ServiceMoc k.Object); | |
| 22 | } | |
| 23 | ||
| 24 | [T est] | |
| 25 | pu blic void _UserInfo_ ValidUser_ ReturnsPar tialViewUs erInfoView Model() | |
| 26 | { | |
| 27 | // Arran ge | |
| 28 | _userSer viceMock.S etup(m => m.GetUser( )).Returns (FakeDataM anager.Get User(0)); | |
| 29 | // Act | |
| 30 | var resu lt = _cont roller._Us erInfo(); | |
| 31 | // Asser t | |
| 32 | Assert.I sNotNull(r esult); | |
| 33 | Assert.I sInstanceO f(typeof(P artialView Result), r esult); | |
| 34 | Assert.I sInstanceO f(typeof(U serInfoVie wModel), ( (PartialVi ewResult)r esult).Vie wData.Mode l); | |
| 35 | Assert.Are Equal(" DNS \\ DNS FLINTF",(( UserInfoVi ewModel)(( PartialVie wResult)re sult).View Data.Model ).User.Dom ainPlusNet workUserNa me); | |
| 36 | Assert.A reEqual("F lintstone, Fred", (( UserInfoVi ewModel)(( PartialVie wResult)re sult).View Data.Model ).User.Nam e); | |
| 37 | } | |
| 38 | ||
| 39 | [T est] | |
| 40 | pu blic void LoginPost_ UserNameNu ll_Returns LoginViewM odel() | |
| 41 | { | |
| 42 | // Arran ge | |
| 43 | _userSer viceMock.S etup(m => m.GetUser( )).Returns (FakeDataM anager.Get User(0)); | |
| 44 | LoginVie wModel vie wModel = n ew LoginVi ewModel(); | |
| 45 | // Act | |
| 46 | var resu lt = _cont roller.Log in(viewMod el); | |
| 47 | // Asser t | |
| 48 | Assert.I sNotNull(r esult); | |
| 49 | Assert.I sInstanceO f(typeof(V iewResult) , result); | |
| 50 | Assert.I sInstanceO f(typeof(L oginViewMo del), ((Vi ewResult)r esult).Vie wData.Mode l); | |
| 51 | Assert.I sFalse(str ing.IsNull OrEmpty((( ViewResult )result).V iewBag.Err orMessage) ); | |
| 52 | } | |
| 53 | ||
| 54 | [T est] | |
| 55 | pu blic void LoginPost_ VistaUserF aultDivisi onNotSuppo rted_Redir ectsToLogi n() | |
| 56 | { | |
| 57 | // Arran ge | |
| 58 | _userSer viceMock.S etup(m => m.GetUser( )).Returns (FakeDataM anager.Get User(0)); | |
| 59 | _userSer viceMock.S etup(m => m.GetViaUs er(It.IsAn y<string>( ), It.IsAn y<string>( ), It.IsAn y<string>( ), It.IsAn y<short>() )) | |
| 60 | .Ret urns(FakeD ataManager .GetViaUse r(viaBAppr oved: true , faultMes sage:"Divi sion is no t supporte d")); | |
| 61 | LoginVie wModel vie wModel = n ew LoginVi ewModel{Us erName = " fredflinst one", Pass word = "xx x", sta3n = (short)8 88}; | |
| 62 | // Act | |
| 63 | var resu lt = _cont roller.Log in(viewMod el); | |
| 64 | // Asser t | |
| 65 | Assert.I sNotNull(r esult); | |
| 66 | Assert.I sInstanceO f(typeof(R edirectToR outeResult ), result) ; | |
| 67 | Assert.A reEqual("D ivision", ((Redirect ToRouteRes ult)result ).RouteVal ues["actio n"].ToStri ng()); | |
| 68 | Assert.A reEqual("U ser", ((Re directToRo uteResult) result).Ro uteValues[ "controlle r"].ToStri ng()); | |
| 69 | } | |
| 70 | } | |
| 71 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.