Exemple #1
0
        public void UpdateMemberOverwrites()
        {
            ITeamRepository   repository = new TestMemoryTeamRepository();
            MembersController controller = new MembersController(repository);

            Guid teamId    = Guid.NewGuid();
            Team team      = new Team("TestTeam", teamId);
            var  debugTeam = repository.Add(team);

            Guid   memberId  = Guid.NewGuid();
            Member newMember = new Member(memberId);

            newMember.FirstName = "Jim";
            newMember.LastName  = "Smith";
            controller.CreateMember(newMember, teamId);

            team = repository.Get(teamId);

            Member updatedMember = new Member(memberId);

            updatedMember.FirstName = "Bob";
            updatedMember.LastName  = "Jones";
            controller.UpdateMember(updatedMember, teamId, memberId);

            team = repository.Get(teamId);
            Member testMember = team.Members.Where(m => m.ID == memberId).First();

            Assert.Equal(testMember.FirstName, "Bob");
            Assert.Equal(testMember.LastName, "Jones");
        }
Exemple #2
0
        public void CreateMemberAddsTeamToList()
        {
            ITeamRepository   repository = new TestMemoryTeamRepository();
            MembersController controller = new MembersController(repository);

            Guid teamId = Guid.NewGuid();
            Team team   = new Team("TestController", teamId);

            repository.Add(team);

            Guid   newMemberId = Guid.NewGuid();
            Member newMember   = new Member(newMemberId);

            controller.CreateMember(newMember, teamId);

            team = repository.Get(teamId);
            Assert.True(team.Members.Contains(newMember));
        }