public void RepositoryFactoryCreateRepositoryExceptionTest()
 {
     using (var context = new FootballLeagueContext())
     {
         var result = RepositoryFactory.CreateRepository <IRepository <Players> >(context);
     }
 }
 public MatchServices(FootballLeagueContext context, ITeamServices teamServices,
                      ITeamMatchServices teamMatchServices)
 {
     this._context           = context;
     this._teamServices      = teamServices;
     this._teamMatchServices = teamMatchServices;
 }
Esempio n. 3
0
 public Repository(
     FootballLeagueContext context
     )
 {
     this.context  = context;
     this.entities = context.Set <T>();
 }
 public void TrasferStatusSetTest()
 {
     using (var context = new FootballLeagueContext())
     {
         context.Transfers.Single().Status = TransferStatus.Accepted;
     }
 }
 public void TransferStatusTest()
 {
     using (var context = new FootballLeagueContext())
     {
         var transferStatus = context.Transfers.Single().Status;
         Assert.IsTrue(transferStatus.Equals(TransferStatus.Pending));
     }
 }
 public void BindingListTest()
 {
     using (var context = new FootballLeagueContext())
     {
         var a = context.Users.Local.Count;
         Assert.IsTrue(a == 0);
     }
 }
Esempio n. 7
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            FootballLeagueContext context = new FootballLeagueContext();

            context.Database.CreateIfNotExists();
        }
 public void RepositoryFactoryTest()
 {
     using (var context = new FootballLeagueContext())
     {
         RepositoryFactory.Register <IRepository <Players>, Repository <Players> >();
         var repository = RepositoryFactory.CreateRepository <IRepository <Players> >(context);
         var player     = repository.Get(0);
     }
 }
 public void RepositoryTest()
 {
     using (var context = new FootballLeagueContext())
     {
         var repo = new Repository <Users>(context);
         Assert.AreEqual((repo.GetAllOrderedBy(OrderTypeEnum.Descending, usr => usr.Login) as List <Users>)?.Count,
                         repo.GetAll().OrderByDescending(usr => usr.Login).ToList().Count);
     }
 }
        public ActionResult Index()
        {
            var teams = new List <Team>();

            using (FootballLeagueContext db = new FootballLeagueContext())
            {
                teams = db.Teams.OrderByDescending(x => x.Points).ToList();
            }

            return(View(teams));
        }
Esempio n. 11
0
        public ActionResult Index()
        {
            var matches = new List <Match>();

            using (FootballLeagueContext db = new FootballLeagueContext())
            {
                matches = db.Matches
                          .Include(x => x.LeftTeam)
                          .Include(x => x.RightTeam)
                          .OrderByDescending(x => x.Id)
                          .ToList();
            }

            return(View(matches));
        }
 public void LoadMethodTest()
 {
     using (var context = new FootballLeagueContext())
     {
         context.Users.Load();
         var user = new Users
         {
             Login    = "******",
             Password = "******"
         };
         var local1 = context.Users.Local;
         context.Users.Local.Add(user);
         context.Users.Load();
         var local2 = context.Users.Local;
         Assert.IsNotNull(context.Users.Local.Single(usr => usr.Equals(user)));
         Assert.IsTrue(ReferenceEquals(local1, local2));
     }
 }
Esempio n. 13
0
 public Repository(FootballLeagueContext _context)
 {
     this._context = _context;
     table         = _context.Set <T>();
 }
Esempio n. 14
0
 public Repository()
 {
     this._context = new FootballLeagueContext();
     table         = _context.Set <T>();
 }
Esempio n. 15
0
 public TeamServices(FootballLeagueContext context)
 {
     this._context = context;
 }