public void Map_Test() { #region === ARRANGE === SessionToken token = new SessionToken { userId = 555, userName = "******" }; SessionTokenToUserAppModelMapper mapper = new SessionTokenToUserAppModelMapper(); #endregion #region === ACT === UserAppModel result = mapper.Map(token); #endregion #region === ASSERT === Assert.AreEqual <int>(token.userId, result.id); Assert.AreEqual <string>(token.userName, result.username); Assert.AreEqual <bool>(true, result.active); #endregion }
public void MapList_Test() { #region === ARRANGE === List <SessionToken> tokenList = new List <SessionToken>() { new SessionToken { userId = 771, userName = "******" }, new SessionToken { userId = 772, userName = "******" }, new SessionToken { userId = 773, userName = "******" }, new SessionToken { userId = 774, userName = "******" }, new SessionToken { userId = 775, userName = "******" }, new SessionToken { userId = 776, userName = "******" }, new SessionToken { userId = 777, userName = "******" } }; SessionTokenToUserAppModelMapper mapper = new SessionTokenToUserAppModelMapper(); #endregion #region === ACT === IList <UserAppModel> result = mapper.Map(tokenList); #endregion #region === ASSERT === Assert.AreEqual <int>(tokenList.Count, result.Count); for (int i = 0; i < tokenList.Count; i++) { Assert.AreEqual <int>(tokenList[i].userId, result[i].id); Assert.AreEqual <string>(tokenList[i].userName, result[i].username); Assert.AreEqual <bool>(true, result[i].active); } #endregion }