public void TestUserInformationPermission_Set_7() { UserInformation info = new UserInformation(); int[] indexList = new int[3] { 0, 1, 2 }; info.PermissionList = indexList; Assert.AreEqual(info.CityPermissioin, 7); }
public void TestUserInformationPermission_SetAndGet() { UserInformation info = new UserInformation(); info.PermissionList = new int[4] { 3, 6, 8, 13 }; Assert.AreEqual(info.PermissionList.ElementAt(0), 3); Assert.AreEqual(info.PermissionList.ElementAt(1), 6); Assert.AreEqual(info.PermissionList.ElementAt(2), 8); Assert.AreEqual(info.PermissionList.ElementAt(3), 13); }
public void TestUserInformationPermission_Get_7() { UserInformation info = new UserInformation() { CityPermissioin = 7 }; IEnumerable<int> permissionList = info.PermissionList; Assert.AreEqual(permissionList.Count(), 3); Assert.AreEqual(permissionList.ElementAt(0), 0); Assert.AreEqual(permissionList.ElementAt(1), 1); Assert.AreEqual(permissionList.ElementAt(2), 2); }
public UserInformation AddUser(UserInformation user) { if (user != null) { UserInformation existedUser = userInformations.FirstOrDefault( x => x.UserName == user.UserName); if (existedUser == null) { userInformations.Add(user); } return existedUser; } return user; }
public void TestInitialize() { InitializeMockObject(); UserInformation user = new UserInformation { UserName = "******", CityPermissioin = (1 << 21) - 1 }; mockUserRepository.Setup(x => x.UserInformations).Returns(new List<UserInformation>{ user }.AsQueryable()); controller = new NavController(mockRepository.Object, mockUserRepository.Object, null); controller.CurrentUser = "******"; }
public UserInformation AddUser(UserInformation user) { if (user != null) { UserInformation existedUser = UserInformations.FirstOrDefault( x => x.UserName == user.UserName); if (existedUser == null) { context.UserInformations.Add(user); context.SaveChanges(); } return existedUser; } return user; }