public void Initialize() { IConfiguration ObjConfiguration = new ConfigurationBuilder() .SetBasePath(AppDomain.CurrentDomain.BaseDirectory) .AddJsonFile("appsettings.json") .Build(); string str = ObjConfiguration.GetConnectionString("Constr"); DbContextOptions <DBContext> options = new DbContextOptionsBuilder <DBContext>().UseSqlServer(str).Options; DBContext ObjContext = new DBContext(options); IRepository3 rp = new Repository3(ObjContext); seclist = new SectorListController(rp); stpr = new SectorStockPriceController(rp); }
public void TestInitialize() { eNodebRepository.Setup(x => x.GetAll()).Returns(new List <ENodeb> { new ENodeb { ENodebId = 1, Longtitute = 112.1, Lattitute = 23.1 } }.AsQueryable()); eNodebRepository.Setup(x => x.GetAllList()).Returns(eNodebRepository.Object.GetAll().ToList()); eNodebRepository.Setup(x => x.Count()).Returns(eNodebRepository.Object.GetAll().Count()); cellRepository.Setup(x => x.GetAll()).Returns(new List <Cell> { new Cell { ENodebId = 1, SectorId = 0, Azimuth = 30, Height = 10 }, new Cell { ENodebId = 1, SectorId = 1, Azimuth = 150, Height = 10 }, new Cell { ENodebId = 1, SectorId = 2, Azimuth = 270, Height = 10 } }.AsQueryable()); cellRepository.Setup(x => x.GetAllList()).Returns(cellRepository.Object.GetAll().ToList()); cellRepository.Setup(x => x.Count()).Returns(cellRepository.Object.GetAll().Count()); controller = new SectorListController(eNodebRepository.Object, cellRepository.Object); }