Exemplo n.º 1
0
        static void RunSampleD()
        {
            var teamRockyId         = new TeamId(1);
            var teamRocky           = new SampleD.Team(teamRockyId);
            var teamMemberTheHulkId = new TeamMemberId(2);
            var teamMemberTheHulk   = new SampleD.TeamMember(teamRockyId, teamMemberTheHulkId, new DateTime(2010, 1, 1));
            var teamRepository      = new SampleD.TeamRepository(new Dictionary <TeamId, SampleD.Team> {
                { teamRockyId, teamRocky }
            });
            var teamMemberRepository = new SampleD.TeamMemberRepository(new Dictionary <TeamMemberId, SampleD.TeamMember> {
                { teamMemberTheHulkId, teamMemberTheHulk }
            });
            var teamChairmanshipRepository = new SampleD.TeamChairmanshipRepository(new List <SampleD.TeamChairmanship>());
            var makeChairmanService        = new SampleD.AppointChairmanService(teamRepository, teamMemberRepository, teamChairmanshipRepository);
            var service = new SampleD.TeamApplicationService(makeChairmanService);
            var request = new AppointChairmanRequest {
                TeamId = 1, TeamMemberId = 2
            };

            service.When(request);
        }
Exemplo n.º 2
0
 public TeamChairmanship AppointChairman(TeamMember member)
 {
     Enforce.That(member.IsPartOf(_id), Sorry.NotPartOfTheTeam);
     Enforce.That(member.IsMemberSinceAtLeastTwoYears(), Sorry.NotMemberSinceAtLeastTwoYears);
     return(new TeamChairmanship(_id, member.Id, DateTime.Today));
 }
Exemplo n.º 3
0
 static void RunSampleD()
 {
     var teamRockyId = new TeamId(1);
       var teamRocky = new SampleD.Team(teamRockyId);
       var teamMemberTheHulkId = new TeamMemberId(2);
       var teamMemberTheHulk = new SampleD.TeamMember(teamRockyId, teamMemberTheHulkId, new DateTime(2010, 1, 1));
       var teamRepository = new SampleD.TeamRepository(new Dictionary<TeamId, SampleD.Team> { { teamRockyId, teamRocky } });
       var teamMemberRepository = new SampleD.TeamMemberRepository(new Dictionary<TeamMemberId, SampleD.TeamMember> { { teamMemberTheHulkId, teamMemberTheHulk } });
       var teamChairmanshipRepository = new SampleD.TeamChairmanshipRepository(new List<SampleD.TeamChairmanship>());
       var makeChairmanService = new SampleD.AppointChairmanService(teamRepository, teamMemberRepository, teamChairmanshipRepository);
       var service = new SampleD.TeamApplicationService(makeChairmanService);
       var request = new AppointChairmanRequest { TeamId = 1, TeamMemberId = 2 };
       service.When(request);
 }
Exemplo n.º 4
0
 public TeamChairmanship AppointChairman(TeamMember member)
 {
     Enforce.That(member.IsPartOf(_id), Sorry.NotPartOfTheTeam);
       Enforce.That(member.IsMemberSinceAtLeastTwoYears(), Sorry.NotMemberSinceAtLeastTwoYears);
       return new TeamChairmanship(_id, member.Id, DateTime.Today);
 }