Beispiel #1
0
        public void VSSessionGeneral()
        {
            using (var context = ModelUserContext.Instance as EidssUserContext)
            {
                var target = new EidssSecurityManager();
                int result = target.LogIn(Organizaton, Admin, AdminPassword);
                Assert.AreEqual(0, result);

                using (var manager = DbManagerFactory.Factory.Create(context))
                {
                    var acc = VsSession.Accessor.Instance(null);
                    manager.BeginTransaction();

                    var vs = acc.CreateNewT(manager);
                    Assert.IsNotNull(vs);
                    long id = vs.idfVectorSurveillanceSession;

                    //The case could not be saved unless the diagnosis is given
                    vs.Validation += hc_Validation_idfsTentativeDiagnosis;
                    Assert.IsTrue(acc.Post(manager, vs));
                    vs.Validation -= hc_Validation_idfsTentativeDiagnosis;

                    vs = acc.SelectByKey(manager, id);
                    Assert.IsNotNull(vs);

                    manager.RollbackTransaction();
                }
                EidssUserContext.Clear();
            }
        }
Beispiel #2
0
 public void MyTestCleanup()
 {
     lock (m_Lock)
     {
         EidssUserContext.Instance.Close();
         EidssUserContext.Clear();
     }
 }
Beispiel #3
0
 public override void TestCleanup()
 {
     if (context != null)
     {
         context.Close();
         context = null;
     }
     base.TestCleanup();
     EidssUserContext.Clear();
 }
Beispiel #4
0
        //[Ignore]
        public void VsSummaryTableTest()
        {
            EidssUserContext.Init();
            var session = VsSessionTest.GetTestSession();

            var frm = new Form
            {
                Size          = new Size(500, 300),
                StartPosition = FormStartPosition.CenterScreen,
            };

            var navBarControl = new NavBarControl();

            frm.Controls.Add(navBarControl);
            navBarControl.Dock = DockStyle.Fill;
            navBarControl.FillTestSummary(SummaryTable.GetSummaryTables(session.FieldTests));

            frm.ShowDialog();
            EidssUserContext.Clear();
        }
Beispiel #5
0
        public void ImportFromMdbFileTest()
        {
            string path      = PathToTestFolder.Get(TestFolders.Db) + "Data\\";
            long   start     = 1009508;
            long   chunkSize = 10000;

            EidssUserContext.Init();
            DbManagerFactory.SetSqlFactory(bv.common.Configuration.Config.GetSetting("EidssConnectionString"));
            for (long i = start; i < 1009509; i += chunkSize)
            {
                var timer = new PerformanceTimer("mdb records loading", 0);
                using (var _manager = DbManagerFactory.Factory.Create(EidssUserContext.Instance))
                {
                    var _accessor = Upload506Master.Accessor.Instance(null);
                    var _master   = _accessor.CreateNewT(_manager, null);
                    var result    = _master.GetItems(path + "Cddata.mdb", i, chunkSize);
                    timer.Stop();
                    Debug.WriteLine("records from {0} to {1} loading time:{2}", i, i + chunkSize, timer.Time());
                    timer = new PerformanceTimer("set item resolution", 0);
                    foreach (var item in _master.Items)
                    {
                        item.Resolution = (int)Upload506Resolution.Created;
                    }
                    timer.Stop();
                    Debug.WriteLine("set item resolution time:{0}", timer.Time());

                    Assert.AreEqual(Upload506FileError.Success, result);
                    Assert.AreEqual(chunkSize, _master.Items.Count);
                    Assert.AreEqual(Upload506MasterState.ReadyForValidation, _master.GetState());
                    timer = new PerformanceTimer("post", 0);
                    Assert.IsTrue(_accessor.Post(_manager, _master));
                    timer.Stop();
                    Debug.WriteLine("records from {0} to {1} posting time:{2}", i, i + chunkSize, timer.Time());
                }
            }
            EidssUserContext.Clear();
        }
Beispiel #6
0
        public void FFDeterminantWindowTest()
        {
            EidssUserContext.Init();

            var            dbService         = new DbService();
            var            transactionOpened = false;
            SqlTransaction transaction       = null;

            try
            {
                if (dbService.Connection.State == ConnectionState.Closed)
                {
                    dbService.Connection.Open();
                }
                Assert.IsTrue(dbService.Connection.State == ConnectionState.Open);

                dbService.LoadFormTypes();
                Assert.IsTrue(dbService.MainDataSet.FormTypes.Count > 0);

                dbService.LoadSections(null, null, null);
                Assert.IsTrue(dbService.MainDataSet.Sections.Count > 0);

                dbService.LoadParameters(null, null);
                Assert.IsTrue(dbService.MainDataSet.Parameters.Count > 0);

                var rowFormType =
                    Enumerable.Where(dbService.MainDataSet.FormTypes,
                                     c => c.idfsFormType == (long)FFTypeEnum.VectorTypeSpecificData).
                    SingleOrDefault();

                Assert.IsNotNull(rowFormType);

                #region Создаём новый шаблон

                var rowTemplate = dbService.MainDataSet.Templates.NewTemplatesRow();
                rowTemplate.idfsFormType = rowFormType.idfsFormType;
                //если это первый шаблон в своём типе формы, то сделаем его UNI
                rowTemplate.blnUNI           = (dbService.GetTemplatesByFormType(rowFormType.idfsFormType).Length == 0);
                rowTemplate.DefaultName      = "Template1";
                rowTemplate.NationalName     = "Template1";
                rowTemplate.NationalLongName = "Template Long name 1";
                rowTemplate.langid           = ModelUserContext.CurrentLanguage;
                dbService.MainDataSet.Templates.AddTemplatesRow(rowTemplate);

                #endregion

                var form = new FFDeterminants(dbService, rowTemplate);
                BaseFormManager.ShowModal(form, null);
                //BaseFormManager.ShowModal(form, null, ref id, null, null);
                Assert.IsNotNull(form.SelectedDeterminantsRow);

                //присваиваем шаблону выбранный детерминант
                var determinant = dbService.CreateTemplateDeterminantValuesRow(form.SelectedDeterminantsRow,
                                                                               rowTemplate.idfsFormTemplate,
                                                                               rowTemplate.idfsFormType);

                //сохраняем
                transaction       = (SqlTransaction)dbService.Connection.BeginTransaction();
                transactionOpened = true;
                dbService.PostDetail(dbService.MainDataSet, 0, transaction);
                //
                Assert.IsTrue(determinant.idfDeterminantValue > -1);
                Assert.IsTrue(rowTemplate.idfsFormTemplate > -1);

                transaction.Commit();
                transactionOpened = false;

                //создаём новый датасервис, чтобы проверить, сохранились ли детерминанты
                var dbService2 = new DbService();

                dbService2.LoadTemplateDeterminants(rowTemplate.idfsFormTemplate);
                var determinantTemplate =
                    dbService2.MainDataSet.TemplateDeterminantValues.SingleOrDefault(c => c.idfDeterminantValue == determinant.idfDeterminantValue);
                Assert.IsNotNull(determinantTemplate);

                #region удаляем добавленные элементы

                dbService.DeleteDeterminantsFromTemplate(rowTemplate.idfsFormTemplate);
                rowTemplate.Delete();

                #endregion

                dbService.PostDetail(dbService.MainDataSet, 0, null);

                //transaction.Rollback();
                //transactionOpened = false;
            }
            finally
            {
                if ((transaction != null) && transactionOpened)
                {
                    transaction.Rollback();
                }
                if (dbService.Connection.State != ConnectionState.Closed)
                {
                    dbService.Connection.Close();
                }
            }

            EidssUserContext.Clear();
        }