public void CanSave()
        {
            _data.CreateAccount1();
            var profile1 = _data.CreateProfileForAccount1();
            _data.CreateAccount2();
            var profile2 = _data.CreateProfileForAccount2();

            var team = new Team
                           {
                               MaxSize = 14,
                               Name = "MyBestTeam",
                               PlayersIds = new List<string> {profile1.ProfileName, profile2.ProfileName},
                               Creator = profile1.ProfileName
                           };

            var saved = _repo.Save(team);

            var retrievedTeam = _repo.GetById(team.Id);
            Assert.True(saved);
            Assert.That(retrievedTeam.MaxSize, Is.EqualTo(team.MaxSize));
            Assert.That(retrievedTeam.Name, Is.EqualTo(team.Name));
            Assert.That(retrievedTeam.PlayersIds.Count, Is.EqualTo(2));
            Assert.That(retrievedTeam.PlayersIds[0], Is.EqualTo(profile1.ProfileName));
            Assert.That(retrievedTeam.PlayersIds[1], Is.EqualTo(profile2.ProfileName));
            Assert.That(retrievedTeam.Creator, Is.EqualTo(profile1.ProfileName));
        }
Beispiel #2
0
 public void HoldAMaxSizeAndDefaultsToOne()
 {
     var team = new Team();
     Assert.AreEqual(Constants.DefaultTeamSize, team.MaxSize);
     team.MaxSize = 5;
     Assert.AreEqual(5, team.MaxSize);
 }
Beispiel #3
0
 public void HasANameAndHasADefaultName()
 {
     const string name = "Big Team";
     var team = new Team {Name = name};
     Assert.AreEqual(name, team.Name);
     team = new Team();
     Assert.AreEqual(Constants.DefaultTeamName, team.Name);
 }
        public void CanOnlyDeleteIfOwner()
        {
            var teamRepo = new Mock<ITeamRepository>();

            var request = new DeleteTeamRequest
                              {
                TeamId = "123",
                ProfileId = "ProfileId"
            };
            var team = new Team(request.TeamId) {Creator = "NotCreator"};
            teamRepo.Setup(x => x.GetById(request.TeamId)).Returns(team);

            var handler = new DeleteTeamRequestHandle(teamRepo.Object);

            var response = handler.Handle(request);

            Assert.That(response.Status, Is.EqualTo(ResponseCodes.NotCreator));
        }
        public void CanGetTeam()
        {
            var team = new Team();

            var teamRepo = new Mock<ITeamRepository>();
            teamRepo.Setup(x => x.GetById(team.Id)).Returns(team);

            var request = new ViewTeamRequest
                              {
                                  TeamId = team.Id
                              };

            var handler = new ViewTeamRequestHandle(teamRepo.Object);

            var response = handler.Handle(request);

            Assert.That(response.Team, Is.SameAs(team));
        }
        public void CanGetListOfTeamsForProfile()
        {
            _data.CreateAccount1();
            var profile = _data.CreateProfileForAccount1();
            var team = new Team
            {
                MaxSize = 14,
                Name = "MyBestTeam",
                PlayersIds = new List<string> { profile.ProfileName },
                Creator = profile.ProfileName
            };
            _repo.Save(team);

            var teams = _repo.GetTeamsForProfile(profile.ProfileName);

            Assert.That(teams.Count, Is.EqualTo(1));
            Assert.That(teams[0].Name, Is.EqualTo(team.Name));
            Assert.That(teams[0].MaxSize, Is.EqualTo(team.MaxSize));
        }
        public void CanDeleteATeam()
        {
            var teamRepo = new Mock<ITeamRepository>();

            var request = new DeleteTeamRequest()
                              {
                                  TeamId = "123",
                                  ProfileId = "ProfileId"
                              };
            var team = new Team(request.TeamId) { Creator = request.ProfileId };
            teamRepo.Setup(x => x.GetById(request.TeamId)).Returns(team);

            var handler = new DeleteTeamRequestHandle(teamRepo.Object);

            var response = handler.Handle(request);

            Assert.That(response.Status, Is.EqualTo(ResponseCodes.Success));
            teamRepo.Verify(x => x.DeleteTeam(request.TeamId));
        }
 public bool Save(Team team)
 {
     throw new System.NotImplementedException();
 }
 public void SetUp()
 {
     _team = new Team();
     _teamGame = new TeamGame(DateTime.Now, new Sport(), new Location());
 }
Beispiel #10
0
 public void HoldsAListOfPlayers()
 {
     var team = new Team();
     Assert.NotNull(team.PlayersIds);
 }
Beispiel #11
0
 public void EveryGameHasAGameIdThatIsAGuidCreatedAtCreationgOfGame()
 {
     var team = new Team();
     Assert.NotNull(team.Id);
 }
        public Team CreateTeam3()
        {
            var teamRepo = new TeamRepository();
            var team = new Team
            {
                MaxSize = 3,
                Name = TeamName3,
                PlayersIds = new List<string>(),
                Creator = Profile2Id
            };

            TeamId3 = team.Id;

            teamRepo.Save(team);
            return team;
        }
        public Team CreateTeam1()
        {
            var teamRepo = new TeamRepository();
            var team = new Team
                           {
                               MaxSize = 14,
                               Name = TeamName1,
                           };
            TeamId1 = team.Id;

            teamRepo.Save(team);
            return team;
        }