public void ClearEntitlementsCache_Valid() { string description = "Verify that when the ClearEntitlementsCache Method is called then no exception occurs."; ClearEntitlementsCacheRequest request = new ClearEntitlementsCacheRequest(); try { Target.ClearEntitlementsCache(); _writer.WriteLog(serviceName, "ClearEntitlementsCache_Valid", DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(), description, SBWSCommon.StatusLevelOptions.PASS.ToString(), "Proper Response return on Test Harness. ", root); } catch (FaultException ex) { _writer.WriteLog(serviceName, "ClearEntitlementsCache_Valid", DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(), description, SBWSCommon.StatusLevelOptions.PASS.ToString(), "Proper Response not return on Test Harness. | " + ex.Message, root); } }
public void GetCourses_valid() { #region Local var GetCoursesRequest getCoursesRequest = new GetCoursesRequest(); GetCoursesResponse getCoursesResponse = new GetCoursesResponse(); CourseResponse courseResponse = new CourseResponse(); Course[] Course = null; StringBuilder sbError = new StringBuilder(); string Test_Result_Upsert = String.Empty; #endregion try { for (int i = 0; i < 5; i++) { if (i == 0)//If Provided ContactCrmId has entitlement for the given ProductCrmId { getCoursesRequest.contactCrmId = ValidNonCebUser[0]; getCoursesRequest.productCrmId = ProductCrmId; } else if (i == 1)//method should return all the courses with in a given ProductCrmId(Course bundle) { getCoursesRequest.contactCrmId = null; getCoursesRequest.productCrmId = ProductCrmId; } else if (i == 2)//number of courses returned in response object of method is mapped with SFDC data { getCoursesRequest.contactCrmId = ValidNonCebUser[0]; getCoursesRequest.productCrmId = ProductCrmId; } try { getCoursesResponse = target.GetCourses(getCoursesRequest); courseResponse = getCoursesResponse.GetCoursesResult; if (courseResponse.Courses.Length > 0) { Course = courseResponse.Courses; } bool IsEntitledChk = true; if (i == 0 || i == 1) { //Validate Course having isentite true for (int j = 0; j < Course.Length; j++) { if (Course[j].IsEntitled == false) { IsEntitledChk = false; } } } //TODO: Call SFDC replica for validation of return courses if (i == 0) { Test_Result_Upsert = _Assert.Execute( () => _Assert.AssertTrue(getCoursesResponse != null, "getCoursesResponse return null", root), () => _Assert.AssertTrue(courseResponse.Courses.Length > 0, "courseResponse return count 0", root), () => _Assert.AssertTrue(IsEntitledChk == true, "IsEntitledChk return false against getcourse", root), () => _Assert.AssertTrue(Course[0].CourseCategory != null, "CourseCategory is null", root), () => _Assert.AssertTrue(Course[0].CourseCrmId != null, "CourseCrmId is null", root), () => _Assert.AssertTrue(Course[0].CourseName != null, "CourseName is null", root), () => _Assert.AssertTrue(Course[0].CourseNumber != null, "CourseNumber is null", root) ); if (Test_Result_Upsert == "") { if (i == 0) { _writer.WriteLog(serviceName, "GetCourses_valid|ContactCrmId::" + getCoursesRequest.contactCrmId + "|ProductCrmId::" + getCoursesRequest.productCrmId, DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(), "Call GetCourses method If Provided ContactCrmId has entitlement for the given ProductCrmId than, IsEntitled response object is true ", SBWSCommon.StatusLevelOptions.PASS.ToString(), "To Verify that fields available while calling GetCourses Method CourseCategory[0]:" + Course[0].CourseCategory + "|CourseCrmId[0]:" + Course[0].CourseCrmId + "|CourseName[0]:" + Course[0].CourseName + "|CourseNumber[0]:" + Course[0].CourseNumber + "|IsEntitled response object is true", root); } } else { _writer.WriteLog(serviceName, "GetCourses_valid|ContactCrmId::" + getCoursesRequest.contactCrmId + "|ProductCrmId::" + getCoursesRequest.productCrmId, DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(), "Call GetCourses method If Provided ContactCrmId has entitlement for the given ProductCrmId than, IsEntitled response object is true ", SBWSCommon.StatusLevelOptions.FAIL.ToString(), "To Verify that fields available while calling GetCourses Method CourseCategory[0]:" + Course[0].CourseCategory + "|CourseCrmId[0]:" + Course[0].CourseCrmId + "|CourseName[0]:" + Course[0].CourseName + "|CourseNumber[0]:" + Course[0].CourseNumber + "|IsEntitled response object is true|Error:" + Test_Result_Upsert, root); } } else if (i == 1) { Test_Result_Upsert = _Assert.Execute( () => _Assert.AssertTrue(getCoursesResponse != null, "getCoursesResponse return null", root), () => _Assert.AssertTrue(courseResponse.Courses.Length > 0, "courseResponse return count 0", root), () => _Assert.AssertTrue(IsEntitledChk == true, "IsEntitledChk return false against getcourse", root) ); if (Test_Result_Upsert == "") { _writer.WriteLog(serviceName, "GetCourses_valid|ContactCrmId::" + getCoursesRequest.contactCrmId + "|ProductCrmId::" + getCoursesRequest.productCrmId, DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(), "Call GetCourses method should return all the courses with in a given ProductCrmId(Course bundle) ", SBWSCommon.StatusLevelOptions.PASS.ToString(), "To Verify that fields available while calling GetCourses Method | Course lenth:" + Course.Length, root); } else { _writer.WriteLog(serviceName, "GetCourses_valid|ContactCrmId::" + getCoursesRequest.contactCrmId + "|ProductCrmId::" + getCoursesRequest.productCrmId, DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(), "Call GetCourses method should return all the courses with in a given ProductCrmId(Course bundle) ", SBWSCommon.StatusLevelOptions.FAIL.ToString(), "To Verify that fields available while calling GetCourses Method | Course lenth:" + Course.Length + "+Error:" + Test_Result_Upsert, root); } } else if (i == 2) { Test_Result_Upsert = _Assert.Execute( () => _Assert.AssertTrue(getCoursesResponse != null, "getCoursesResponse return null", root), () => _Assert.AssertTrue(courseResponse.Courses.Length > 0, "courseResponse return count 0", root), () => _Assert.AssertTrue(IsEntitledChk == true, "IsEntitledChk return false against getcourse", root) ); if (Test_Result_Upsert == "") { _writer.WriteLog(serviceName, "GetCourses_valid|ContactCrmId::" + getCoursesRequest.contactCrmId + "|ProductCrmId::" + getCoursesRequest.productCrmId, DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(), "Call GetCourses method should return all the courses with in a given ProductCrmId(Course bundle) ", SBWSCommon.StatusLevelOptions.PASS.ToString(), "To Verify that fields available while calling GetCourses Method | Course lenth:" + Course.Length, root); } else { _writer.WriteLog(serviceName, "GetCourses_valid|ContactCrmId::" + getCoursesRequest.contactCrmId + "|ProductCrmId::" + getCoursesRequest.productCrmId, DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(), "Call GetCourses method should return all the courses with in a given ProductCrmId(Course bundle) ", SBWSCommon.StatusLevelOptions.FAIL.ToString(), "To Verify that fields available while calling GetCourses Method | Course lenth:" + Course.Length + "+Error:" + Test_Result_Upsert, root); } } } catch (Exception ex0) { throw; } } } catch (Exception ex) { throw; } finally { getCoursesRequest = null; getCoursesResponse = null; } }
public void GetCountry() { try { for (int k = 0; k < validCountryPrimaryKeyId.Count; k++) { //Fill dataset with CDS return values. DataSet Data = new DataSet(); string Test_Result = String.Empty; bool is_Active = false; string Query = "select * from mfweb.tbl_CountryLookup where IsActive=1 and PK_Id=" + Convert.ToInt32(validCountryPrimaryKeyId[k]); Data = _Common.ExecuteDatabase(_Common.CDS_ConnectionString, Query, "Select"); //Call WebService method Country actual = target.GetCountry(Convert.ToInt32(validCountryPrimaryKeyId[k])); if (!string.IsNullOrEmpty(Data.Tables[0].Rows[0]["CventCountryCode"].ToString())) { cventCountryCode = Convert.ToString(Data.Tables[0].Rows[0]["CventCountryCode"]); } else { cventCountryCode = null; } if (Convert.ToBoolean(Data.Tables[0].Rows[0]["isActive"]) == true) { is_Active = Convert.ToBoolean(Data.Tables[0].Rows[0]["isActive"]); } else { is_Active = 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, is_Active, "IsActive dint match", root) ); if (Test_Result == "") { _writer.WriteLog(serviceName, "GetCountry", DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(), "Verify the correctness of account data", SBWSCommon.StatusLevelOptions.PASS.ToString(), Test_Result, root); } else { _writer.WriteLog(serviceName, "GetCountry:", 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; } }