Inheritance: ITeamRepository
Ejemplo n.º 1
0
 static void RunSampleA2()
 {
     var teamRockyId = new TeamId(1);
       var teamRocky = new SampleA2.Team(teamRockyId);
       var teamMemberTheHulkId = new TeamMemberId(2);
       var teamMemberTheHulk = new SampleA2.TeamMember(teamRockyId, teamMemberTheHulkId, new DateTime(2010, 1, 1));
       var teamRepository = new SampleA2.TeamRepository(new Dictionary<TeamId, SampleA2.Team> { { teamRockyId, teamRocky } });
       var teamMemberRepository = new SampleA2.TeamMemberRepository(new Dictionary<TeamMemberId, SampleA2.TeamMember> { { teamMemberTheHulkId, teamMemberTheHulk } });
       var service = new SampleA2.TeamApplicationService(teamRepository, teamMemberRepository);
       var request = new AppointChairmanRequest { TeamId = 1, TeamMemberId = 2 };
       try {
     service.When(request);
       } catch (InvalidOperationException) { }
       teamRocky.AddMember(teamMemberTheHulkId);
       service.When(request);
 }
Ejemplo n.º 2
0
        static void RunSampleA2()
        {
            var teamRockyId         = new TeamId(1);
            var teamRocky           = new SampleA2.Team(teamRockyId);
            var teamMemberTheHulkId = new TeamMemberId(2);
            var teamMemberTheHulk   = new SampleA2.TeamMember(teamRockyId, teamMemberTheHulkId, new DateTime(2010, 1, 1));
            var teamRepository      = new SampleA2.TeamRepository(new Dictionary <TeamId, SampleA2.Team> {
                { teamRockyId, teamRocky }
            });
            var teamMemberRepository = new SampleA2.TeamMemberRepository(new Dictionary <TeamMemberId, SampleA2.TeamMember> {
                { teamMemberTheHulkId, teamMemberTheHulk }
            });
            var service = new SampleA2.TeamApplicationService(teamRepository, teamMemberRepository);
            var request = new AppointChairmanRequest {
                TeamId = 1, TeamMemberId = 2
            };

            try {
                service.When(request);
            } catch (InvalidOperationException) { }
            teamRocky.AddMember(teamMemberTheHulkId);
            service.When(request);
        }