Пример #1
0
        public void TestAddUserToAccount()
        {
            var conn    = new EntityConnection(SerializationTests.ConnectionString);
            var repo    = new ModuleRepository(conn);
            var account = new Account {
                Name          = "DBServer",
                SubdomainName = "dbserver"
            };
            var user = repo.GetUserByName("dbserver");

            account.Users.Add(user);
            repo.AddAccount(account);
            repo.Save();

            var newAcct = repo.GetAccountByName("dbserver");

            Assert.IsNotNull(newAcct);

            var newUser = newAcct.Users.FirstOrDefault(u => u.UserId == user.UserId);

            Assert.IsNotNull(newUser);
        }