public async Task SaveMember_NewWithExistingUserName_Throws() { var team = teamRepository.stagedTeams.First().Value; var existingTeamMember = teamRepository.stagedTeamMembers.First(); var teamMember = new EMBC.ESS.Shared.Contracts.Team.TeamMember { Id = null, FirstName = "newf", LastName = "lastf", UserName = existingTeamMember.Value.UserName, TeamId = team.Id }; var exception = await adminManager.Handle(new SaveTeamMemberCommand { Member = teamMember }).ShouldThrowAsync <UsernameAlreadyExistsException>(); exception.UserName.ShouldBe(teamMember.UserName); }
public async Task SaveMember_NewWithUniqueUserName_Added() { var team = teamRepository.stagedTeams.First().Value; var teamMember = new EMBC.ESS.Shared.Contracts.Team.TeamMember { Id = null, FirstName = "newf", LastName = "lastf", UserName = "******", TeamId = team.Id }; var memberId = await adminManager.Handle(new SaveTeamMemberCommand { Member = teamMember }); memberId.ShouldNotBeNull(); teamRepository.stagedTeamMembers.Keys.ShouldContain(memberId); }