Example #1
0
        public async Task UsersControllerTests_CreateUser()
        {
            var user           = UserDummyGenerator.Generate();
            var userRepository = UserRepositoryMock.GetMock();
            var unitOfWork     = UnitOfWorkMock.GetMock();
            var userController = new UsersController(unitOfWork.Object, userRepository.Object);

            var result = await userController.CreateUser(user);

            Assert.NotNull(result);
            Assert.IsType <OkResult>(result);

            userRepository.Verify(x => x.AddAsync(It.Is <User>(y => y == user)));
            unitOfWork.Verify(x => x.CommitAsync());
        }