Beispiel #1
0
        public void DataAccessTest_GetFillRects()
        {
            string server = testContextInstance.DataRow["Server"].ToString();
            string login = testContextInstance.DataRow["Login"].ToString();
            string password = testContextInstance.DataRow["Password"].ToString();
            bool shouldPass = bool.Parse(testContextInstance.DataRow["ShouldPass"].ToString());
            string exception = string.Empty;
            string connectionMain = string.Empty;
            string connectionApp = string.Empty;
            HttpDataClient test = new HttpDataClient();

            //var result = new ExelConverter.Core.DataObjects.Size[] { };
            bool passed = false;
            string errMsg = string.Format("server:{1}{0}login:{2}{0}password:{3}{0}connectionMain:{4}{0}connectionApp:{5}{0}shouldpass:{6}{0}passed:{7}{0}exception:{8}", Environment.NewLine, server, login, password, connectionMain, connectionApp, shouldPass, passed, exception);

            try
            {
                test.Login(server, login, password);

                connectionMain = test.ConnectionStringMain;
                connectionApp = test.ConnectionStringApp;

                alphaEntities.ProviderConnectionString = connectionMain;
                //exelconverterEntities2.ProviderConnectionString = connectionApp;

                DataAccess da = new DataAccess();

                ExelConverter.Core.DataObjects.Operator[] tps = da.GetOperators();

                int cnt = tps.Length >= 5 ? 5 : tps.Length;
                int step = (int)((float)tps.Length / (float)cnt);

                List<ExelConverter.Core.DataObjects.FillArea> resLst = new List<ExelConverter.Core.DataObjects.FillArea>();

                for (int i = 0; i < tps.Length; i+= step )
                {
                    foreach(var item in da.GetFillRects((int)tps[i].Id))
                        resLst.Add(item);
                    //Assert.IsNotNull(result, errMsg + string.Format("{0}result is NULL for type:{1}", Environment.NewLine, tp.Name));
                    //Assert.AreNotEqual(result.Length, 0, errMsg + string.Format("{0}result is EMPTY for type:{1}", Environment.NewLine, tp.Name));
                }

                passed = true;
            }
            catch (Exception ex) { exception = ex.Message; }

            errMsg = string.Format("server:{1}{0}login:{2}{0}password:{3}{0}connectionMain:{4}{0}connectionApp:{5}{0}shouldpass:{6}{0}passed:{7}{0}exception:{8}", Environment.NewLine, server, login, password, connectionMain, connectionApp, shouldPass, passed, exception);
            Assert.AreEqual(passed, shouldPass, errMsg);
        }