예제 #1
0
        public void TestGetUser()
        {
            using (var context = new ItsOnlyHeroesEntities())
            {
                var expectedUserName = "******";
                var heroUser         = context.Users.Find(1);

                Assert.AreEqual(expectedUserName, heroUser.UserName);
            }
        }
예제 #2
0
        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);
            }
        }