public void GetUserAccount() { var userAccount = new UserAccount { LoginName = "*****@*****.**", Password = "******", Name = "Freetime Admin", UserProfile = 0, WebTheme = 0, Theme = 0, IsActive = true }; var authenticationSession = new Mock<AuthenticationSession> { CallBase = true }; var anitoSession = new Mock<ISession> { CallBase = true }; anitoSession.Setup(x => x.GetT(It.IsAny<Expression<Func<UserAccount, bool>>>())).Returns(userAccount); authenticationSession.Protected().Setup<ISession>("CurrentSession").Returns(anitoSession.Object); var actual = authenticationSession.Object.GetUserAccount("*****@*****.**"); Assert.AreEqual(userAccount, actual); }
private AuthenticationLogic GetLogic() { var authenticationSession = new Mock<IAuthenticationSession>(); var userAccount = new UserAccount { LoginName = "admin", Password = "******", Name = "Freetime-G Administrator", UserProfile = 1, WebTheme = 1, Theme = 1, IsActive = true }; authenticationSession.Setup(x => x.GetUserAccount("admin")).Returns(userAccount); var authenticationLogic = new Mock<AuthenticationLogic> { CallBase = true }; authenticationLogic.Protected().Setup<IAuthenticationSession>("CurrentSession").Returns(authenticationSession.Object); return authenticationLogic.Object; }