Exemplo n.º 1
0
        public void GetCountryBySystemName()
        {
            try
            {
                for (int i = 0; i < validCountryBySystemName.Count; i++)
                {
                    //Fill dataset with CDS return values.
                    DataSet Data        = new DataSet();
                    string  Test_Result = String.Empty;
                    string  Query       = "select * from mfweb.tbl_CountryLookup where IsActive=1 and SystemName='" + validCountryBySystemName[i] + "'";
                    Data = _Common.ExecuteDatabase(_Common.CDS_ConnectionString, Query, "Select");
                    //Call WebService method
                    Country actual = target.GetCountryBySystemName(validCountryBySystemName[i]);

                    if (!string.IsNullOrEmpty(Data.Tables[0].Rows[0]["CventCountryCode"].ToString()))
                    {
                        cventCountryCode = Convert.ToString(Data.Tables[0].Rows[0]["CventCountryCode"]);
                    }
                    else
                    {
                        cventCountryCode = null;
                    }
                    if (!string.IsNullOrEmpty(Data.Tables[0].Rows[0]["IsActive"].ToString()))
                    {
                        isActive = Convert.ToBoolean(Data.Tables[0].Rows[0]["IsActive"]);
                    }
                    else
                    {
                        isActive = false;
                    }

                    Test_Result = _Assert.Execute(
                        () => _Assert.AssertIsNotNull(actual, "Reasponse is not null", root),
                        () => _Assert.AssertAreEqual(string.IsNullOrEmpty(actual.CventCountryCode) ? null : actual.CventCountryCode, cventCountryCode, "CventCountryCode dint match", root),
                        () => _Assert.AssertAreEqual(actual.IsActive, isActive, "IsActive dint match", root)
                        );
                    if (Test_Result == "")
                    {
                        _writer.WriteLog(serviceName, "GetCountriesByDisplayName", DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(), "Verify the correctness of account data", SBWSCommon.StatusLevelOptions.PASS.ToString(), Test_Result, root);
                    }
                    else
                    {
                        _writer.WriteLog(serviceName, "GetCountriesByDisplayName", DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(), "Verify the correctness of account data", SBWSCommon.StatusLevelOptions.FAIL.ToString(), Test_Result, root);
                        ////throw new Exception(Test_Result);
                    }
                }
            }
            catch (Exception)
            {
                ////throw;
            }
        }