public void GetList_ExceptionWhenGetResponseStream_ReturnsEmptyList() { // Arrange var webException = new WebException(); Mock <WebResponse> webResponse = CreateWebResponse(webException); Mock <WebRequest> webRequest = CreateWebRequest(webResponse); var queryParameter = string.Empty; Mock <ISFUtilities> sfUtilities = CreateSFUtilities(EmailBouncedDateProperty); sfUtilities.Setup(x => x.CreateQueryRequest( It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Method>(), It.IsAny <ResponseType>())) .Returns(webRequest.Object) .Callback <string, string, Method, ResponseType>((token, query, method, response) => { queryParameter = query; }); sfUtilities.Setup(x => x.LogWebException(It.IsAny <WebException>(), It.IsAny <string>())); ECN_Framework_Entities.Salesforce.SalesForceBase.InitializeSFUtilities(sfUtilities.Object); // Act var contactsList = SF_Lead.GetList(string.Empty, string.Empty); // Assert contactsList.ShouldBeEmpty(); sfUtilities.Verify(x => x.LogWebException(webException, queryParameter), Times.Once()); }
public void GetList_TwoResponsesOneWithFalseDoneAndOneWithTrueDoneBothHasEmailBouncedDate_ReturnsListWithTwoItems() { // Arrange var webResponse = CreateWebResponse(EmailBouncedDateProperty); var webRequest = CreateWebRequest(webResponse); Mock <ISFUtilities> sfUtilities = CreateSFUtilities(EmailBouncedDateProperty); sfUtilities.Setup(x => x.CreateQueryRequest( It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Method>(), It.IsAny <ResponseType>())).Returns(webRequest.Object); ECN_Framework_Entities.Salesforce.SalesForceBase.InitializeSFUtilities(sfUtilities.Object); // Act var contactsList = SF_Lead.GetList(string.Empty, string.Empty); // Assert contactsList.ShouldNotBeNull(); contactsList.Count.ShouldBe(2); sfUtilities.VerifyAll(); }