Exemplo n.º 1
0
        public RoomContainerTests()
        {
            repo      = new InMemRepository();
            container = new RoomContainer(
                repo.CreateRoomContainerDAL(),
                repo.CreateRoomDAL(),
                repo.CreateRoundDAL(),
                repo.CreateUserDAL(),
                repo.CreateBetDAL(),
                new Wheel(new NumberGenerator()));

            room = new Room(1,
                            repo.CreateRoomDAL(),
                            repo.CreateRoundDAL(),
                            repo.CreateUserDAL(),
                            repo.CreateBetDAL(),
                            new Wheel(new NumberGenerator()));
        }
Exemplo n.º 2
0
 public UserContainerTests()
 {
     repo      = new InMemRepository();
     container = new UserContainer(repo.CreateUserContainerDAL(), repo.CreateUserDAL(), repo.CreateBetDAL());
     user      = new User("Test", repo.CreateUserDAL(), repo.CreateBetDAL())
     {
         Id = 15
     };
 }
Exemplo n.º 3
0
        public AdminTests()
        {
            repo      = new InMemRepository();
            admin     = new Admin(repo.CreateAdminDAL());
            user      = new User("Test", repo.CreateUserDAL(), repo.CreateBetDAL());
            container = new UserContainer(repo.CreateUserContainerDAL(), repo.CreateUserDAL(), repo.CreateBetDAL());

            admin.NewUserAdded     += container.ReceiveNewUserNotification;
            admin.UserModification += container.ReceiveUserModificationNotification;
        }
Exemplo n.º 4
0
        public void GetAllINTEGRATION_ShouldGetCalledAfterInitialisation()
        {
            // Arrange
            var roomsExpected   = TestDB.GetRoomsTable();
            var roundsExpected  = TestDB.GetRoundsTable();
            var pocketsExpected = TestDB.GetPocketTable();
            var usersExpected   = TestDB.GetUserTable();

            int roomsCountExpected   = roomsExpected.Count;
            int roundsCountExpected  = roundsExpected.Count;
            int playerCountExpected  = usersExpected.Count;
            int pocketsCountExpected = pocketsExpected.Count;


            // Act
            // Initializing RoomContainer should inititialize all data of rooms, rounds and pockets.
            RoomContainer container = new RoomContainer(repo.CreateRoomContainerDAL(),
                                                        repo.CreateRoomDAL(),
                                                        repo.CreateRoundDAL(),
                                                        repo.CreateUserDAL(),
                                                        repo.CreateBetDAL(),
                                                        new Wheel(new NumberGenerator()));

            int roomsCountResult   = 0;
            int roundsCountResult  = 0;
            int playerCountResult  = 0;
            int pocketsCountResult = 0;


            foreach (var room in container.Rooms)
            {
                roomsCountResult++;
                var tempRoom = room;
                foreach (var round in tempRoom.Rounds)
                {
                    roundsCountResult++;
                    var tempRound = round;

                    if (tempRound.Pocket != null)
                    {
                        pocketsCountResult++;
                    }
                }
                foreach (var player in tempRoom.Players)
                {
                    playerCountResult++;
                }
            }

            // Assert
            Assert.Equal(roomsCountExpected, roomsCountResult);
            Assert.Equal(roundsCountExpected, roundsCountResult);
            Assert.Equal(pocketsCountExpected, pocketsCountResult);
        }
Exemplo n.º 5
0
        public RoomTests()
        {
            repo      = new InMemRepository();
            generator = new NumberGenerator();
            wheel     = new Wheel(generator);
            room      = new Room(1, repo.CreateRoomDAL(), repo.CreateRoundDAL(), repo.CreateUserDAL(), repo.CreateBetDAL(), wheel);


            player = new User("test", repo.CreateUserDAL(), repo.CreateBetDAL())
            {
                Id = 1
            };
            round = new Round(8, repo.CreateRoundDAL(), wheel);
        }
Exemplo n.º 6
0
 public UserTests()
 {
     repo = new InMemRepository();
     user = new User("test", repo.CreateUserDAL(), repo.CreateBetDAL());
     bet  = new ColorBet(IPocketColor.Black);
 }