Beispiel #1
0
 public void MyTestInitialize()
 {
     BaseReportTests.InitDBAndLogin();
     DbManagerFactory.SetSqlFactory(new ConnectionCredentials(null, "AvrService").ConnectionString, DatabaseType.Avr);
     DbManagerFactory.SetSqlFactory(new ConnectionCredentials(null, "Archive").ConnectionString, DatabaseType.Archive);
     DbManagerFactory.SetSqlFactory(Config.GetSetting("EidssConnectionString"));
 }
Beispiel #2
0
        public void MyTestInitialize()
        {
            m_Container = StructureMapContainerInit();
            BaseReportTests.InitDBAndLogin();
            using (PresenterFactory.BeginSharedPresenterTransaction(m_Container, new BaseForm()))
            {
                m_LayoutDB = new WinLayout_DB(PresenterFactory.SharedPresenter.SharedModel);
            }
            lock (m_LayoutDB.Connection)
            {
                OpenConnection();
                using (var command = new SqlCommand(GetQueryIdSQL))
                {
                    command.Connection = (SqlConnection)m_LayoutDB.Connection;
                    m_TestQueryId      = (long)command.ExecuteScalar();
                }
                CloseConnection();
            }

            m_PivotDB = new BaseAvrDbService();
            m_LayoutDB.AddLinkedDbService(m_PivotDB, null, RelatedPostOrder.SkipPost);

            m_ChartDB = new BaseAvrDbService();
            m_LayoutDB.AddLinkedDbService(m_ChartDB, null, RelatedPostOrder.SkipPost);

            LookupManager.AddObject("Query", null, AvrQueryLookup.Accessor.Instance(null).GetType(), "_SelectListInternal");
            LookupManager.AddObject("LayoutFolder", null, AvrFolderLookup.Accessor.Instance(null).GetType(), "_SelectListInternal");
            LookupManager.AddObject("Layout", null, AvrLayoutLookup.Accessor.Instance(null).GetType(), "_SelectListInternal");

            m_PresenterTransaction = PresenterFactory.BeginSharedPresenterTransaction(m_Container, new BaseForm());
        }
Beispiel #3
0
        public void GetAllRegionsTest()
        {
            BaseReportTests.InitDBAndLogin();
            List <SelectListItemSurrogate> regions = FilterHelper.GetAllRegions("en");

            Assert.IsNotNull(regions);
            Assert.IsTrue(regions.Count > 0, "Region lookup is empty");
            Assert.IsTrue(regions.Exists(c => c.Text == "Abkhazia"), "Region Abkhazia not found");
        }
Beispiel #4
0
        public void GetHumanDiagnosisListTest()
        {
            BaseReportTests.InitDBAndLogin();
            List <SelectListItemSurrogate> humanDiagnosisList = FilterHelper.GetHumanDiagnosisList("en");

            Assert.IsNotNull(humanDiagnosisList);
            Assert.IsTrue(humanDiagnosisList.Count > 0, "Diagnosis lookup is empty");
            Assert.IsTrue(humanDiagnosisList.Exists(c => c.Text == "Botulism"), "Botulism diagnosis not found");
        }
Beispiel #5
0
 public void GetGetKzFilterListTest()
 {
     BaseReportTests.InitDBAndLogin();
     foreach (ReportFilterType filter in Enum.GetValues(typeof(ReportFilterType)))
     {
         if (filter != ReportFilterType.None)
         {
             List <SelectListItemSurrogate> list = FilterHelper.GetKzFilterList("en", filter);
             Assert.IsNotNull(list);
             Assert.IsTrue(list.Count > 0, string.Format("Lookup {0} is empty", filter));
         }
     }
 }
Beispiel #6
0
 public void GetDefaultLocationTest()
 {
     BaseReportTests.InitDBAndLogin();
     using (new CultureInfoTransaction(new CultureInfo("en-US")))
     {
         long?regionId;
         long?rayonId;
         FilterHelper.GetDefaultLocation(out regionId, out rayonId);
         Assert.IsNotNull(regionId);
         // Note: commented because for Tbilisi rayon is NULL
         //   Assert.IsNotNull(rayonId);
     }
 }
Beispiel #7
0
        public void FormN1ModelTest()
        {
            BaseReportTests.InitDBAndLogin();

            var model = new FormNo1Model();

            Assert.IsNotNull(model.SelectedCurrentMonthList);
            Assert.AreEqual(13, model.SelectedCurrentMonthList.Count);
            Assert.IsNotNull(model.SelectedJanuaryMonthList);
            Assert.AreEqual(13, model.SelectedJanuaryMonthList.Count);
            Assert.IsNotNull(model.PageSizeList);
            Assert.AreEqual(2, model.PageSizeList.Count);
        }
Beispiel #8
0
        public void AddressModelInternalTest()
        {
            BaseReportTests.InitDBAndLogin();

            var model = new AddressModel();

            Assert.IsNotNull(model.InternalAddress(null));
            Assert.IsNotNull(model.InternalAddress(null).RegionLookup);
            Assert.IsTrue(model.InternalAddress(null).RegionLookup.Count > 1);
            RegionLookup anyRegion = model.InternalAddress(null).RegionLookup.First(r => r.idfsRegion > 0);

            Assert.IsTrue(model.InternalAddress(null).RayonLookup.Count == 1);
            model.InternalAddress(null).Region = anyRegion;
            Assert.IsTrue(model.InternalAddress(null).RayonLookup.Count > 1);
        }
Beispiel #9
0
        public void AddressModelRegionRayonTest()
        {
            BaseReportTests.InitDBAndLogin();

            var model = new AddressModel();
            List <SelectListItemSurrogate> regions = model.GetSelectedRegions(null);

            Assert.IsNotNull(regions);
            Assert.IsTrue(regions.Count > 1);
            RegionLookup anyRegion = model.InternalAddress(null).RegionLookup.First(r => r.idfsRegion > 0);

            Assert.IsTrue(model.GetRayons(null).Count == 1);
            model.RegionId = anyRegion.idfsRegion;
            Assert.IsTrue(model.GetRayons(null).Count > 1);
        }
Beispiel #10
0
        public void CultureInfoTtransactionTest()
        {
            BaseReportTests.LoadAssemblies();

            BaseReportTests.InitDBAndLogin();

            CultureInfo info = CultureInfo.GetCultureInfo("ka-GE");

            Thread.CurrentThread.CurrentUICulture = info;
            Thread.CurrentThread.CurrentCulture   = info;
            using (new CultureInfoTransaction(CultureInfo.GetCultureInfo("en-US")))
            {
                Console.WriteLine(Thread.CurrentThread.CurrentCulture);
                Assert.AreEqual("en-US", Thread.CurrentThread.CurrentCulture.Name);
                Assert.AreEqual("en-US", Thread.CurrentThread.CurrentUICulture.Name);
            }
            Assert.AreEqual(info, Thread.CurrentThread.CurrentCulture);
            Assert.AreEqual(info, Thread.CurrentThread.CurrentUICulture);
        }
Beispiel #11
0
        public void GetCachedViewTest()
        {
            BaseReportTests.InitDBAndLogin();

            var  facade   = new AVRFacade(m_Container);
            long layoutId = LayoutFormSave();

            List <long> queryIdList = facade.GetQueryIdList();

            Assert.IsNotNull(queryIdList);
            Assert.IsTrue(queryIdList.Count > 0);

            List <long> layoutIdList = facade.GetLayoutIdList();

            Assert.IsNotNull(layoutIdList);
            Assert.IsTrue(layoutIdList.Count > 0);

            ViewDTO model = facade.GetCachedView("xxx", layoutId, "en");

            Assert.IsNotNull(model);
            Assert.IsNotNull(model.BinaryViewHeader);
            Assert.IsNotNull(model.Header);
            Assert.IsNotNull(model.BodyPackets);

            byte[]  unzippedViewStructure = BinaryCompressor.Unzip(model.BinaryViewHeader);
            string  xmlViewStructure      = BinarySerializer.DeserializeToString(unzippedViewStructure);
            AvrView view       = AvrViewSerializer.Deserialize(xmlViewStructure);
            string  viewXmlNew = AvrViewSerializer.Serialize(view);

            Assert.IsNotNull(viewXmlNew);

            BaseTableDTO unzippedDTO = BinaryCompressor.Unzip(model);
            DataTable    viewData    = BinarySerializer.DeserializeToTable(unzippedDTO);
            string       dataXmlNew  = DataTableSerializer.Serialize(viewData);

            Assert.IsNotNull(dataXmlNew);
        }
Beispiel #12
0
 public static void MyClassInitialize(TestContext testContext)
 {
     BaseReportTests.LoadAssemblies();
 }
Beispiel #13
0
 public void TestInitialize()
 {
     BaseReportTests.InitSupportedLanguages();
 }
Beispiel #14
0
 public void MyTestInitialize()
 {
     BaseReportTests.LoadAssemblies();
     BaseReportTests.InitDBAndLogin();
 }
Beispiel #15
0
 public void MyTestInitialize()
 {
     BaseReportTests.InitDBAndLogin();
 }
 public static void MyClassInitialize(TestContext testContext)
 {
     BaseReportTests.InitDBAndLogin();
     BaseReportTests.LoadAssemblies();
     m_Factory = new ReportFactory();
 }