示例#1
0
        public void ShouldGetTeamsList()
        {
            // arrange
            var teamList = new List <Team>()
            {
                new Team()
                {
                    Name = "Dionin"
                }
            };
            var contextOptionsBuilder = new DbContextOptionsBuilder().UseInMemoryDatabase("testing");
            var teamServiceMock       = new Mock <ITeamService>().Setup(service => service.List()).Returns(teamList);

            using (var db = new ArenaContext(contextOptionsBuilder.Options))
            {
                db.Set <Team>().AddRange(teamList);
                db.SaveChanges();
            }

            using (var db = new ArenaContext(contextOptionsBuilder.Options))
            {
                using var unitOfWork = new UnitOfWork(db);
                var service = new TeamService(unitOfWork);

                // act
                var result = service.List();

                // assert
                Assert.NotNull(result);
                Assert.Equal(teamList.Count, result.Count());
            }
        }
 // Methods
 public override void RenderPrompt(PlaceHolder placeHolder, ArenaContext currentContext, IFieldInfo fieldInfo, bool setValues, string formCssClass)
 {
     RenderPrompt(placeHolder, currentContext, fieldInfo, setValues, formCssClass);
     foreach (Control control in placeHolder.Controls)
     {
         if (control is LiteralControl)
         {
             LiteralControl control2 = (LiteralControl)control;
             control2.Text = control2.Text.Replace("<b>City</b>", "").Replace("&nbsp;<b>State</b>", "").Replace("&nbsp;<b>Zip</b>", "");
         }
     }
 }
示例#3
0
 public ArenasController(ArenaContext context)
 {
     _context = context;
 }
示例#4
0
 public TeamRepository(ArenaContext context) : base(context)
 {
 }
示例#5
0
 public CitiesController(ArenaContext context)
 {
     _context = context;
 }
示例#6
0
 public UnitOfWork(ArenaContext context)
 {
     _context = context;
 }
示例#7
0
 public BaseRepository(ArenaContext context)
 {
     _context = context;
     _dbSet   = _context.Set <T>();
 }
示例#8
0
 public DbContextCatalogItemService(ArenaContext arenaContext)
 {
     _arenaContext = arenaContext;
 }