public HotelServiceTest()
 {
     options = TestDbOptions.Get();
     mockPropertyTypeService = new Mock <IPropertyTypeService>();
     mockImageService        = new Mock <IImageService>();
     mockMapper = new Mock <IMapper>();
 }
Esempio n. 2
0
        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}");
        }
Esempio n. 3
0
        public void Init()
        {
            _options = TestDbOptions.GetInMemoryOptions <SettingsContext>();
            var context = new SettingsContext(_options);

            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();

            _emrs = Builder <EmrSystem> .CreateListOfSize(2).Build().ToList();

            _docket = Builder <Docket> .CreateNew().Build();

            _iqcareExtract = Builder <Extract> .CreateNew().With(x => x.DocketId = _docket.Id).With(x => x.EmrSystemId = _emrs.First().Id).Build();

            _iqcareExtract.ExtractSql = @"SELECT * FROM [AppAdmin]";
            _kenyaExtract             = Builder <Extract> .CreateNew().With(x => x.DocketId = _docket.Id).With(x => x.EmrSystemId = _emrs.Last().Id).Build();

            _kenyaExtract.ExtractSql = @"SELECT * FROM psmart";

            _mssql =
                new DatabaseProtocol(DatabaseType.MicrosoftSQL, @".\koske14", "sa", "maun", "iqcare");
            _mysql =
                new DatabaseProtocol(DatabaseType.MySQL, @"localhost", "root", "root", "openmrs");

            context.Add(_docket);
            context.AddRange(_emrs);
            context.AddRange(new List <Extract> {
                _iqcareExtract, _kenyaExtract
            });
            context.SaveChanges();
        }
 public RestaurantServiceTests()
 {
     options                = TestDbOptions.Get();
     mockMapper             = new Mock <IMapper>();
     mockUserService        = new Mock <IUserService>();
     mockBlobStorageService = new Mock <IBlobStorageService>();
 }
Esempio n. 5
0
        public void Init()
        {
            _options = TestDbOptions.GetInMemoryOptions <ExtractsContext>();
            var context = new ExtractsContext(_options);

            context.SaveChanges();
        }
Esempio n. 6
0
        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));
        }
Esempio n. 7
0
 public void SetUp()
 {
     _tableauWorkbookWithViews = TestHelpers.CreateWorkbooks(3, 2);
     _contextOptions           = TestDbOptions.GetInMemoryOptions <DwhDashboardContext>();
     _context = new DwhDashboardContext(_contextOptions);
     TestHelpers.CreateTestData(_context, _tableauWorkbookWithViews);
     _repository = new TabWorkbookRepository(_context);
 }
Esempio n. 8
0
 public HotelServiceTest()
 {
     options              = TestDbOptions.Get();
     imageServiceMock     = new Mock <IImageService>();
     thumbnailServiceMock = new Mock <IThumbnailService>();
     localizerMock        = new Mock <IStringLocalizer <HotelService> >();
     mapper = new Mock <IMapper>();
 }
 public ReservationServiceTest()
 {
     options           = TestDbOptions.Get();
     mockMapper        = new Mock <IMapper>();
     mockGuestService  = new Mock <IGuestService>();
     mockUserService   = new Mock <IUserService>();
     mockHotelService  = new Mock <IHotelService>();
     mockRoomService   = new Mock <IRoomService>();
     mockConfiguration = new Mock <IConfiguration>();
 }
Esempio n. 10
0
 public void Init()
 {
     _options = TestDbOptions.GetInMemoryOptions<ExtractsContext>();
     var context = new ExtractsContext(_options);
     context.Database.EnsureDeleted();
     context.Database.EnsureCreated();
     var psmartStages = Builder<PsmartStage>.CreateListOfSize(2).All().With(x=>x.Emr="iqcare").Build().ToList();
     context.AddRange(psmartStages);
     context.SaveChanges();
 }
Esempio n. 11
0
        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 Init()
        {
            _options = TestDbOptions.GetInMemoryOptions <SettingsContext>();
            var context = new SettingsContext(_options);

            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();
            var centralRegistries = Builder <CentralRegistry> .CreateListOfSize(2).Build().ToList();

            context.AddRange(centralRegistries);
            context.SaveChanges();
        }
Esempio n. 13
0
        public void Init()
        {
            _options = TestDbOptions.GetInMemoryOptions <SettingsContext>();
            var context = new SettingsContext(_options);

            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();
            _iqcareEmr = new EmrSystem("IQCare", "v1");
            _iqcareEmr.AddProtocol(new DatabaseProtocol(DatabaseType.MicrosoftSQL, @".\koske14", "sa", "maun", "iqcare"));
            _iqcareEmr.AddRestProtocol(new RestProtocol("http://192.168.1.10/api", "xys"));
            context.Add(_iqcareEmr);
            context.SaveChanges();
        }
Esempio n. 14
0
        public void Init()
        {
            _options = TestDbOptions.GetInMemoryOptions <SettingsContext>();
            var context = new SettingsContext(_options);

            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();
            _iqcareEmr = new EmrSystem("IQCare", "v1");
            _iqcareEmr.AddProtocol(new DatabaseProtocol(DatabaseType.MicrosoftSQL, @".\koske14", "sa", "maun", "iqcare"));
            _kenyaEmr = new EmrSystem("KenyaEMR", "v1");
            _kenyaEmr.AddProtocol(new DatabaseProtocol(DatabaseType.MySQL, @"localhost", "root", "root", "openmrs"));
            _otherEmr = new EmrSystem("xEmr", "1");
            _otherEmr.AddProtocol(new DatabaseProtocol(DatabaseType.MySQL, @"localhost", "root", "root", "otheropenmrs"));
            context.AddRange(new List <EmrSystem> {
                _iqcareEmr, _kenyaEmr, _otherEmr
            });
            context.SaveChanges();
        }
Esempio n. 15
0
        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);
        }
Esempio n. 16
0
        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);
        }
Esempio n. 17
0
        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);
        }
Esempio n. 18
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}");
            }
        }
Esempio n. 19
0
 public void Init()
 {
     _options = TestDbOptions.GetInMemoryOptions <ExtractsContext>();
 }
Esempio n. 20
0
 public void Init()
 {
     Factory.Init();
     _options = TestDbOptions.GetInMemoryOptions <TestDbContext>();
 }
Esempio n. 21
0
 public void Init()
 {
     Factory.Init();
     _contextOptions = TestDbOptions.GetInMemoryOptions <DwhDashboardContext>();
 }
 public ReservationServiceTest()
 {
     options          = TestDbOptions.Get();
     localizerMock    = new Mock <IStringLocalizer <ReservationService> >();
     emailServiceMock = new Mock <IEmailService>();
 }
Esempio n. 23
0
 public PostServiceTests()
 {
     options    = TestDbOptions.Get();
     mockMapper = new Mock <IMapper>();
 }
Esempio n. 24
0
 public RoomServiceTest()
 {
     options          = TestDbOptions.Get();
     mockHotelService = new Mock <IHotelService>();
     mockMapper       = new Mock <IMapper>();
 }
Esempio n. 25
0
 public TaxiReservationServiceTest()
 {
     this.options         = TestDbOptions.Get();
     this.mockMapper      = new Mock <IMapper>();
     this.mockUserService = new Mock <IUserService>();
 }