コード例 #1
0
ファイル: User.cs プロジェクト: jonespavan/Tribes
        public Result JoinTribe(HardTribe tribe)
        {
            Result res = tribe.RequestAdmission(this, this);
            if (res.Succeeded)
                MyTribes.Add(tribe);

            return res;
        }
コード例 #2
0
        protected TribesRepository PopulateDummyTribes()
        {
            //arrange
            Chief user1 = new Chief { RegistrationInfo = new Account { FirstName = "Jones", LastName = "Pavan", EmailAddress = "*****@*****.**", Password = "******" } };

            User[] users = {new User {RegistrationInfo= new Account {FirstName="Jones", LastName="Pavan", EmailAddress="*****@*****.**", Password="******"}},
                            new User {RegistrationInfo= new Account {FirstName="Isabella", LastName="Pavan", EmailAddress="*****@*****.**", Password="******"}},
                            new User {RegistrationInfo= new Account {FirstName="Gabriel", LastName="Pavan", EmailAddress="*****@*****.**", Password="******"}},
                            new User {RegistrationInfo= new Account {FirstName="Danielle", LastName="Pavan", EmailAddress="*****@*****.**", Password="******"}}
                           };

            HardTribe trib1 = new HardTribe
            {
                Name = "test1",
                Owner = user1
            };

            HardTribe trib2 = new HardTribe
            {
                Name = "test2",
                Owner = user1
            };

            HardTribe trib3 = new HardTribe
            {
                Name = "test3",
                Owner = user1
            };

            foreach (User u in users)
            {
                trib1.RequestAdmission(u,u);
                trib2.RequestAdmission(u, u);
                trib3.RequestAdmission(u, u);
            }

            //act
            TribesRepository repo = new TribesRepository();
            repo.UpsertTribe(trib1);
            repo.UpsertTribe(trib2);
            repo.UpsertTribe(trib3);

            return repo;
        }