Exemplo n.º 1
0
        public void should_Add_or_Update_Views_When_Update()
        {
            foreach (var w in _tableauViews)
            {
                w.TableauId = $"{w.TableauId}-s";
                w.Name      = $"{w.Name}-s";
                w.Voided    = false;
            }
            var summary = _repository.AddOrUpdateAsync(_tableauViews).Result;

            _repository = new TabViewRepository(_context);
            var updatedViews = _repository.GetAll().ToList();
            var voidedViews  = updatedViews.Where(x => x.Voided).ToList();

            Assert.IsTrue(updatedViews.Count == 3);
            Assert.IsTrue(summary.Inserts == 0);
            Assert.IsTrue(summary.Updates == 3);
            Assert.IsTrue(voidedViews.Count == summary.Voids);

            Console.WriteLine(summary.ShowSummary());
        }
Exemplo n.º 2
0
        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}");
            }
        }