public void GetAll_ExceptionWhenGetResponseStream_ReturnsEmptyList() { // Arrange var webException = new WebException(); var webResponse = CreateWebResponse(webException); var webRequest = CreateWebRequest(webResponse); var queryParameter = string.Empty; var 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.GetAll(string.Empty); // Assert contactsList.ShouldBeEmpty(); sfUtilities.Verify(x => x.LogWebException(webException, queryParameter), Times.Once()); }
public void GetAll_TwoResponsesOneWithFalseDoneAndOneWithTrueDoneBothHasEmailBouncedDate_ReturnsListWithTwoItems() { // Arrange var webResponse = CreateWebResponse(EmailBouncedDateProperty); var webRequest = CreateWebRequest(webResponse); var 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.GetAll(string.Empty); // Assert contactsList.ShouldNotBeNull(); contactsList.Count.ShouldBe(2); sfUtilities.VerifyAll(); }