示例#1
0
 public void AssignConsoleForMembership(Membership membership, Game game)
 {
     game.MembershipId = membership.MembershipId;
     gameRepository.Add(game);
     membership.AddGame(game);
     membershipRepository.Update(membership);
 }
示例#2
0
        public void AssignConsoleForMembership_update_added_game_with_membership_id()
        {
            var membership = new Membership();
            var game = new Game();

            gameService.AssignConsoleForMembership(membership, game);

            game.MembershipId.ShouldEqual(membership.MembershipId);
        }
示例#3
0
        public void AssignConsoleForMembership_adds_game_in_game_repository()
        {
            var membership = new Membership();
            var game = new Game();
            gameRepositoryMock.Setup(repo => repo.Add(game)).Verifiable();

            gameService.AssignConsoleForMembership(membership, game);

            gameRepositoryMock.Verify(repo => repo.Add(game));
            game.MembershipId.ShouldEqual(membership.MembershipId);
        }
示例#4
0
        private void CreateHashForEachGamingConsole(Game game, int bucketCount)
        {
            if (gamingConsoleHash.ContainsKey(game.ConsoleName))
                return;

            var dataForGamingConsole = new List<int>();
            for (var i = 0; i < bucketCount; i++)
            {
                dataForGamingConsole.Add(0);
            }
            gamingConsoleHash.Add(game.ConsoleName, dataForGamingConsole);
        }
示例#5
0
        public void AssignConsoleForMembership_updates_membership_with_the_game_passed()
        {
            var membership = new Membership();
            var game = new Game();
            membershipRepositoryMock.Setup(repo => repo.Update(membership)).Verifiable();

            gameService.AssignConsoleForMembership(membership, game);

            membership.Games.Count.ShouldEqual(1);
            membership.Games.First().ShouldEqual(game);
            membershipRepositoryMock.Verify(repo => repo.Update(membership));
            game.MembershipId.ShouldEqual(membership.MembershipId);
        }
        public void Removes_last_game_instance_in_the_games_list_pass_it_as_view_model()
        {
            var firstGame = new Game();
            var secondGame = new Game();
            Games.Add(firstGame);
            Games.Add(secondGame);

            var viewResult = GameController.RemoveCustomer(Games, CustomUserIdentity);

            var actualGames = viewResult.Model as List<Game>;
            actualGames.Count.ShouldEqual(1);
            actualGames.First().ShouldEqual(firstGame);
        }
示例#7
0
        public void ForMembershipGame_MarkGameAsInvalid_invalidate_both_game_and_game_in_membership()
        {
            var membership = new Membership();
            var game = new Game {MembershipId = membership.MembershipId};
            membership.AddGame(game);
            membershipRepositoryMock.Setup(repo => repo.FindByMembershipId(membership.MembershipId)).Returns(membership);
            gameRepositoryMock.Setup(repo => repo.GetById(game.Id)).Returns(game);
            gameRepositoryMock.Setup(repo => repo.Update(game)).Verifiable();
            membershipRepositoryMock.Setup(repo => repo.Update(membership)).Verifiable();

            gameService.MarkGameAsInvalid(game.Id);

            gameRepositoryMock.Verify(repo => repo.Update(game));
            membershipRepositoryMock.Verify(repo => repo.Update(membership));
            game.IsValid.ShouldBeFalse();
        }
示例#8
0
        public void MarkGameAsInvalid_retrieve_game_from_repository_and_updates_it_as_invalid()
        {
            var game = new Game();
            gameRepositoryMock.Setup(repo => repo.GetById(game.Id)).Returns(game);
            gameRepositoryMock.Setup(repo => repo.Update(game)).Verifiable();

            gameService.MarkGameAsInvalid(game.Id);

            game.IsValid.ShouldBeFalse();
            gameRepositoryMock.Verify(repo => repo.Update(game));
        }
示例#9
0
 public void AddGame(Game game)
 {
     game.GamePaymentType = GamePaymentType.Membership;
     Games.Add(game);
 }
 public MembershipAssignConsoleViewModel()
 {
     Game = new Game();
     Membership = new Membership();
 }