예제 #1
0
        public async Task CreateUser_ReturnsAnOkResultWithTheCreatedUser()
        {
            var controller           = new UserController(_mockUserService.Object);
            var newEmptyUser         = new IUD.Api.Models.User();
            IHttpActionResult result = await controller.Create(newEmptyUser);

            Assert.IsInstanceOfType(result, typeof(OkNegotiatedContentResult <IUD.Api.Models.User>));
        }
예제 #2
0
        public async Task UpdateUser_ReturnsAnOkResultWithAUser()
        {
            var userDb = new User {
                Id = 20, Name = "John", Birthdate = DateTime.Now
            };
            var userModel = new IUD.Api.Models.User {
                Id = 20, Name = "John", Birthdate = DateTime.Now
            };

            _mockUserService.Setup(r => r.Update(userDb)).Returns(true);
            var controller           = new UserController(_mockUserService.Object);
            IHttpActionResult result = await controller.Update(userModel);

            Assert.IsInstanceOfType(result, typeof(OkNegotiatedContentResult <IUD.Api.Models.User>));
        }