Exemplo n.º 1
0
        public void GetCountriesByDisplayName()
        {
            try
            {
                for (int i = 0; i < validCountryDisplayName.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 DisplayName='" + validCountryDisplayName[i] + "'";
                    Data = _Common.ExecuteDatabase(_Common.CDS_ConnectionString, Query, "Select");
                    //Call WebService method
                    List <Country> actual = target.GetCountriesByDisplayName(validCountryDisplayName[i]);
                    for (int j = 0; j < actual.Count; j++)
                    {
                        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[j].CventCountryCode) ? null : actual[j].CventCountryCode, cventCountryCode, "CventCountryCode dint match", root),
                            () => _Assert.AssertAreEqual(actual[j].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;
            }
        }