예제 #1
0
        public void TryDelete()
        {
            var testUserController = new WebAPI.Controllers.UserController();
            int lastUserId         = testUserController.Get().Last().Id;

            var userFromController = testUserController.Delete(lastUserId);

            Assert.AreEqual(userFromController, 1);


            var testUser = testUserController.Get(lastUserId);

            Assert.IsNull(testUser);
        }
예제 #2
0
        public void TryGet1Recover()
        {
            var testUserController = new WebAPI.Controllers.UserController();
            var userFromController = testUserController.Get(1);

            Assert.AreEqual(userFromController.Id, 1);
        }
예제 #3
0
        public void TryGetExist()
        {
            var testUserController = new WebAPI.Controllers.UserController();
            var userFromController = testUserController.Get();

            Assert.IsNotNull(userFromController);
        }
예제 #4
0
        public void TryEdit()
        {
            var testUserController = new WebAPI.Controllers.UserController();
            var lastUser           = testUserController.Get().Last();
            var newName            = Guid.NewGuid().ToString();
            var userFromController = testUserController.Put(
                lastUser.Id,
                new User
            {
                Name      = newName,
                Birthdate = lastUser.Birthdate
            });

            Assert.AreEqual(userFromController, 1);

            var testUser = testUserController.Get(lastUser.Id);

            Assert.AreEqual(testUser.Name, newName);
        }