예제 #1
0
        public CreateCommandResult Execute(CreateCommand input)
        {
            var team = new Team(input.Name, input.Description, input.CreateSharePointSite, input.CreateTeamsChannel);

            foreach (var administrator in input.Administrators)
            {
                team.AddAdministrador(administrator.Name, administrator.EmailAddress);
            }

            _dataService.TeamsRepository.Create(team);
            _dataService.Persist();

            _busPublisher.Publish("teams", new ReadTeamModel()
            {
                Name                 = input.Name,
                Description          = input.Description,
                CreateSharePointSite = input.CreateSharePointSite,
                CreateTeamsChannel   = input.CreateTeamsChannel
            }).GetAwaiter();

            return(new CreateCommandResult()
            {
                Id = team.Id
            });
        }
예제 #2
0
        public void SuccessWhenCreateTeamWithTeamAdministrator()
        {
            var  teamName = "Engineering Team";
            Team team     = new Team(teamName);

            team.AddAdministrador("John Smith", "*****@*****.**");
            var administrators = team.GetAdministrators();

            Assert.AreEqual(1, administrators.Count);
        }