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(" <b>State</b>", "").Replace(" <b>Zip</b>", ""); } } }
public ArenasController(ArenaContext context) { _context = context; }
public TeamRepository(ArenaContext context) : base(context) { }
public CitiesController(ArenaContext context) { _context = context; }
public UnitOfWork(ArenaContext context) { _context = context; }
public BaseRepository(ArenaContext context) { _context = context; _dbSet = _context.Set <T>(); }
public DbContextCatalogItemService(ArenaContext arenaContext) { _arenaContext = arenaContext; }