public void should_Update_Sections() { _tableauWorkbookWithViews = TestHelpers.GetTableauWorkbooks(); _tableauViews = TestHelpers.GetTableauViews(); _tableauViewConfigs = TestHelpers.GetViewConfigs(); _contextOptions = TestDbOptions.GetInMemoryOptions <DwhDashboardContext>(); _context = new DwhDashboardContext(_contextOptions); TestHelpers.CreateTestData(_context, _tableauViewConfigs); TestHelpers.CreateTestData(_context, _tableauWorkbookWithViews); TestHelpers.CreateTestData(_context, _tableauViews); _repository = new TabViewRepository(_context); var updates = _repository.UpdateSections().Result; _repository = new TabViewRepository(_context); var filteredList = _repository.GetViewsFiltered() .FirstOrDefault(x => !string.IsNullOrWhiteSpace(x.CustomParentName)); var filteredListRank = _repository.GetViewsFiltered() .FirstOrDefault(x => x.Rank.HasValue); Assert.IsNotNull(filteredList); Console.WriteLine($"{filteredList.Name}|{filteredList.CustomParentName}"); Assert.IsNotNull(filteredListRank); Console.WriteLine($"{filteredListRank.Name}|{filteredListRank.CustomParentName}"); }
public void should_GetAll_Filtered(string display) { _tableauWorkbookWithViews = TestHelpers.GetTableauWorkbooks(); _tableauViews = TestHelpers.GetTableauViews(); _tableauViewConfigs = TestHelpers.GetViewConfigs(); _contextOptions = TestDbOptions.GetInMemoryOptions <DwhDashboardContext>(); _context = new DwhDashboardContext(_contextOptions); TestHelpers.CreateTestData(_context, _tableauViewConfigs); TestHelpers.CreateTestData(_context, _tableauWorkbookWithViews); TestHelpers.CreateTestData(_context, _tableauViews); _repository = new TabViewRepository(_context); var updates = _repository.UpdateSections().Result; _repository = new TabViewRepository(_context); var filteredList = _repository.GetViewsFiltered().ToList(); Assert.IsNotEmpty(filteredList); filteredList = filteredList .Where(x => x.CustomParentName.ToLower() == display.ToLower()) .ToList(); Console.WriteLine(display); Console.WriteLine(new string('+', 40)); int n = 0; foreach (var v in filteredList) { n++; Console.WriteLine($" {n}. {v.Name}"); } Console.WriteLine(new string('-', 40)); Console.WriteLine(new string('-', 40)); }
public void SetUp() { _tableauWorkbookWithViews = TestHelpers.CreateWorkbooks(3, 2); _contextOptions = TestDbOptions.GetInMemoryOptions <DwhDashboardContext>(); _context = new DwhDashboardContext(_contextOptions); TestHelpers.CreateTestData(_context, _tableauWorkbookWithViews); _repository = new TabWorkbookRepository(_context); }
public void SetUp() { _contextOptions = TestDbOptions.GetInMemoryOptions <DwhDashboardContext>(); _context = new DwhDashboardContext(_contextOptions); _workbooks = TestHelpers.CreateWorkbooks(2, 2); TestHelpers.CreateTestData(_context, _workbooks); _tempOrgs = TestHelpers.CreateOrgs(1); TestHelpers.CreateTestData(_context, _tempOrgs); _repository = new TempOrgRepository(_context, new TabViewRepository(_context)); }
public void SetUp() { var key = File.ReadAllText(TestHelpers.GetKeysFile()).Split('|'); _adminUser = key[0]; _adminPass = key[1]; _contextOptions = TestDbOptions.GetInMemoryOptions <DwhDashboardContext>(); _context = new DwhDashboardContext(_contextOptions); var configs = TestHelpers.GetConfigs(); TestHelpers.CreateTestData(_context, configs); _tabWorkbookRepository = new TabWorkbookRepository(_context); _tabViewRepository = new TabViewRepository(_context); _adminService = new AdminService(_baseUrl, _adminUser, _adminPass); _tabViewService = new TabViewService(_adminService, _baseUrl, _siteName, _tabWorkbookRepository, _tabViewRepository); }
public void SetUp() { _tableauWorkbookWithViews = TestHelpers.CreateWorkbooks(1, 3); _tableauViews = _tableauWorkbookWithViews.SelectMany(x => x.TabViews).ToList(); _contextOptions = TestDbOptions.GetInMemoryOptions <DwhDashboardContext>(); _context = new DwhDashboardContext(_contextOptions); TestHelpers.CreateTestData(_context, _tableauWorkbookWithViews); var configMain = Builder <ViewConfig> .CreateNew().Build(); configMain.Display = "*"; configMain.Containing = "live"; var configAll = Builder <ViewConfig> .CreateNew().Build(); configAll.Display = "ViewX"; configAll.Containing = "dashboard"; TestHelpers.CreateTestData(_context, new List <ViewConfig> { configMain, configAll }); _repository = new TabViewRepository(_context); }
public void SetUp() { _contextOptions = TestDbOptions.GetInMemoryOptions <DwhDashboardContext>(); _context = new DwhDashboardContext(_contextOptions); _organizations = TestHelpers.CreateOrgs(2); TestHelpers.CreateTestData(_context, _organizations); var impersonators = Builder <Impersonator> .CreateListOfSize(1).Build(); TestHelpers.CreateTestData(_context, impersonators); _users = new List <User>(); foreach (var o in _organizations) { var id = impersonators.First().Id; _users.AddRange(TestHelpers.CreateUsers(1, UserType.Steward, o.Id, id)); _users.AddRange(TestHelpers.CreateUsers(3, UserType.Guest, o.Id, id)); _users.AddRange(TestHelpers.CreateUsers(2, UserType.Normal, o.Id, id)); _users.Where(x => x.UserType == UserType.Guest).First().EmailConfirmed = false; } TestHelpers.CreateTestData(_context, _users); _repository = new UserRepository(_context); }
public void should_Get_ViewsFiltered() { _tableauWorkbookWithViews = TestHelpers.GetTableauWorkbooks(); _tableauViews = TestHelpers.GetTableauViews(); _tableauViewConfigs = TestHelpers.GetViewConfigs(); _contextOptions = TestDbOptions.GetInMemoryOptions <DwhDashboardContext>(); _context = new DwhDashboardContext(_contextOptions); TestHelpers.CreateTestData(_context, _tableauViewConfigs); TestHelpers.CreateTestData(_context, _tableauWorkbookWithViews); TestHelpers.CreateTestData(_context, _tableauViews); _repository = new TabViewRepository(_context); var updates = _repository.UpdateSections().Result; _repository = new TabViewRepository(_context); var filteredList = _repository.GetViewsFiltered().ToList(); Assert.IsNotEmpty(filteredList); foreach (var v in filteredList) { Console.WriteLine($"{v.Name}|{v.CustomParentName}"); } }
public void TearDown() { _context.Database.EnsureDeleted(); _context.Dispose(); _context = null; }
public static void CreateTestData <T>(DwhDashboardContext context, IEnumerable <T> entities) where T : class { context.Set <T>().AddRange(entities); context.SaveChanges(); }
public void TearDown() { _context.Dispose(); _context = null; }
public ImpersonatorRepository(DwhDashboardContext context) : base(context) { }
public TabWorkbookRepository(DwhDashboardContext context) : base(context) { }
public TabViewRepository(DwhDashboardContext context) : base(context) { }
public UserRepository(DwhDashboardContext context) : base(context) { }
public OrganizationRepository(DwhDashboardContext context) : base(context) { }
public TempOrgRepository(DwhDashboardContext context, ITabViewRepository tabViewRepository) : base(context) { _tabViewRepository = tabViewRepository; }
public DashboardController(UserManager <User> userManager, DwhDashboardContext appDbContext, IHttpContextAccessor httpContextAccessor) { _caller = httpContextAccessor.HttpContext.User; _appDbContext = appDbContext; }