Exemple #1
0
        public void MyDatabaseTest_ShowAllPlayers()
        {
            //1. arrange
            MyModelContainer container = new MyModelContainer();
            db = new MyDatabase(container);

            //2. act
            IEnumerable<Player> result = db.ShowAllPlayers().ToList();

            //2. assert
            Assert.AreEqual(11, result.Count());
        }
Exemple #2
0
        public void MyDatabaseTest_ShowAllPlayersInTeam_Success()
        {
            //1. arrange
            MyModelContainer container = new MyModelContainer();
            db = new MyDatabase(container);

            //2. act
            IEnumerable<Player> result = db.ShowAllPlayersInTeam("FNATIC");

            //2. assert
            Assert.AreEqual(6, result.Count());
        }
Exemple #3
0
        public void MyDatabaseTest_ShowAllPlayersInTeam_WrongParam()
        {
            //1. arrange
            MyModelContainer container = new MyModelContainer();
            db = new MyDatabase(container);
            int currentCount = container.Teams.Count();

            //2. act
            IEnumerable<Player> result= db.ShowAllPlayersInTeam("joepie");

            //2. assert
            Assert.IsNull(result);
        }
Exemple #4
0
        public void MyDatabaseTest_ShowAllTeams()
        {
            //1. arrange
            MyModelContainer container = new MyModelContainer();

            db = new MyDatabase(container);

            //2. act
            IEnumerable <Team> result = db.ShowAllTeams();

            //2. assert
            Assert.AreEqual(2, result.Count());
        }
Exemple #5
0
        public void MyDatabaseTest_ShowAllPlayersInTeam_Success()
        {
            //1. arrange
            MyModelContainer container = new MyModelContainer();

            db = new MyDatabase(container);

            //2. act
            IEnumerable <Player> result = db.ShowAllPlayersInTeam("FNATIC");

            //2. assert
            Assert.AreEqual(6, result.Count());
        }
Exemple #6
0
        public void MyDatabaseTest_ShowAllPlayers()
        {
            //1. arrange
            MyModelContainer container = new MyModelContainer();

            db = new MyDatabase(container);

            //2. act
            IEnumerable <Player> result = db.ShowAllPlayers().ToList();

            //2. assert
            Assert.AreEqual(11, result.Count());
        }
Exemple #7
0
        public void MyDatabaseTest_ShowAllPlayersInTeam_WrongParam()
        {
            //1. arrange
            MyModelContainer container = new MyModelContainer();

            db = new MyDatabase(container);
            int currentCount = container.Teams.Count();

            //2. act
            IEnumerable <Player> result = db.ShowAllPlayersInTeam("joepie");

            //2. assert
            Assert.IsNull(result);
        }
Exemple #8
0
        public void MyDatabaseTest_AddNewCompetition()
        {
            //1. arrange
            MyModelContainer container = new MyModelContainer();
            db = new MyDatabase(container);
            int currentCount = container.Competitions.Count();
            Team[] teams = container.Teams.ToArray();

            //Short assert
            Assert.IsTrue(teams.Length >= 2);

            //2. act
            Competition comp = db.AddNewCompetition(teams[0], teams[1], DateTime.Now);

            //2. assert
            int newCount = container.Competitions.Count();
            Assert.AreEqual(currentCount + 1, newCount);
            Assert.IsNotNull(comp);
            Assert.IsNotNull(comp.Id);
        }
Exemple #9
0
        public void MyDatabaseTest_UpdateLadder()
        {
            //1. arrange
            MyModelContainer container = new MyModelContainer();

            db = new MyDatabase(container);
            int currentCount = container.Ladders.First().Competitions.Count();

            Team[]      teams = container.Teams.ToArray();
            Competition comp  = db.AddNewCompetition(teams[0], teams[1], DateTime.Now);

            //Short assert
            Assert.IsTrue(teams.Length >= 2);

            //2. act
            db.AddCompetitionToLadder(comp);

            //2. assert
            Ladder ladder   = container.Ladders.First();
            int    newCount = container.Ladders.First().Competitions.Count();

            Assert.AreEqual(currentCount + 1, newCount);
        }
Exemple #10
0
        public void MyDatabaseTest_AddNewCompetition()
        {
            //1. arrange
            MyModelContainer container = new MyModelContainer();

            db = new MyDatabase(container);
            int currentCount = container.Competitions.Count();

            Team[] teams = container.Teams.ToArray();

            //Short assert
            Assert.IsTrue(teams.Length >= 2);

            //2. act
            Competition comp = db.AddNewCompetition(teams[0], teams[1], DateTime.Now);

            //2. assert
            int newCount = container.Competitions.Count();

            Assert.AreEqual(currentCount + 1, newCount);
            Assert.IsNotNull(comp);
            Assert.IsNotNull(comp.Id);
        }
 public EmployeeRepository(MyModelContainer context)
 {
     _dbContext = context;
 }
 public DBManager(string connectionString)
 {
     _dbContext         = new MyModelContainer(connectionString);
     EmployeeRepository = new EmployeeRepository(connectionString);
 }
 public DBManager(MyModelContainer context)
 {
     _dbContext         = new MyModelContainer();
     EmployeeRepository = new EmployeeRepository(context);
 }
 public ReportManager(string connectionString)
 {
     _dbContext = new MyModelContainer(connectionString);
     _dbManager = new DBManager(connectionString);
 }
 public ReportManager(MyModelContainer db)
 {
     _dbContext = new MyModelContainer();
     _dbManager = new DBManager(db);
 }
Exemple #16
0
        public void MyDatabaseTest_ShowAllTeams()
        {
            //1. arrange
            MyModelContainer container = new MyModelContainer();
            db = new MyDatabase(container);

            //2. act
            IEnumerable<Team> result =  db.ShowAllTeams();

            //2. assert
            Assert.AreEqual(2, result.Count());
        }
Exemple #17
0
        public void MyDatabaseTest_UpdateLadder()
        {
            //1. arrange
            MyModelContainer container = new MyModelContainer();
            db = new MyDatabase(container);
            int currentCount = container.Ladders.First().Competitions.Count();
            Team[] teams = container.Teams.ToArray();
            Competition comp = db.AddNewCompetition(teams[0], teams[1], DateTime.Now);

            //Short assert
            Assert.IsTrue(teams.Length >= 2);

            //2. act
            db.AddCompetitionToLadder(comp);

            //2. assert
            Ladder ladder = container.Ladders.First();
            int newCount = container.Ladders.First().Competitions.Count();
            Assert.AreEqual(currentCount + 1, newCount);
        }
 public EmployeeRepository(string connectionString)
 {
     _dbContext = new MyModelContainer(connectionString);
 }