public void TestGetUser() { using (var context = new ItsOnlyHeroesEntities()) { var expectedUserName = "******"; var heroUser = context.Users.Find(1); Assert.AreEqual(expectedUserName, heroUser.UserName); } }
public void TestAddUser() { User newUser = new User(); newUser.Active = true; newUser.DisplayName = "MCubed"; newUser.LastLogin = DateTime.UtcNow; newUser.UserName = "******"; using (var context = new ItsOnlyHeroesEntities()) { var heroUser = context.Users.Add(newUser); context.SaveChanges(); Assert.IsNotNull(heroUser.UserId); Assert.IsTrue(heroUser.UserId > 0); } }