예제 #1
0
        public void AddUserTest()
        {
            var companyId = _companyService.Create("new company");

            var user2Id = _userService.Register(new RegisterDto()
            {
                Name = "user", Email = EmailHelper.Generate(), Password = "******"
            }, null);

            _companyService.AddUser(new CompanyUserDto {
                CompanyId = companyId, UserId = user2Id
            });

            var users = _companyService.ListUsers(companyId);

            Assert.AreEqual(2, users.Count);

            _companyService.AddUser(new CompanyUserDto {
                CompanyId = companyId, UserId = user2Id
            });

            users = _companyService.ListUsers(companyId);
            Assert.AreEqual(2, users.Count);

            _authenticationContext.GetContextUser().Returns(user2Id);

            var companies = _userService.ListCompanies();

            Assert.AreEqual(1, companies.Count);
        }
예제 #2
0
 public void AddUser([FromBody] CompanyUserDto companyUserDto) // POST: api/v1/companies/adduser
 {
     _companyService.AddUser(companyUserDto);
 }