private static void AccountSearchBySSN(ICRMCoreService cRMCoreAccountService) { cRMCoreAccountService.GetCustomerInfoBySSN(Arg.Is <string>(p => p == "123456789")) .Returns(new List <CustomerInfo> { new CustomerInfo() { FirstName = "FirstName", Last4SSN = "1234", LastName = "LastName", AccountIdentifier = "A9DFB55A-2FF9-4D79-B666-04892FBC9CD1", AccountState = "Closed", AccountNumber = "111111111" }, new CustomerInfo() { FirstName = "FirstName1", Last4SSN = "1234", LastName = "LastName1", AccountIdentifier = "B9DFB55A-2FF9-4D79-B666-04892FBC9CD1", AccountState = "Active", AccountNumber = "211111111" } }); cRMCoreAccountService.GetCustomerInfoBySSN(Arg.Is <string>(p => p == "123456782")) .Returns(new List <CustomerInfo> { new CustomerInfo() { FirstName = "FirstName2", Last4SSN = "1232", LastName = "LastName2", AccountIdentifier = "A9DFB55A-2FF9-4D79-B666-04892FBC9CD2", AccountState = "Active", AccountNumber = "111111112" } }); cRMCoreAccountService.GetCustomerInfoBySSN( Arg.Is <string>(p => p == "123456783")) .Returns((List <CustomerInfo>)null); cRMCoreAccountService.When( m => m.GetCustomerInfoBySSN(Arg.Is <string>(p => p == "123456784"))) .Do( x => { throw new GdErrorException( "Error while executing GetCustomerInfoBySSN 123456784"); }); cRMCoreAccountService.When( m => m.GetCustomerInfoBySSN(Arg.Is <string>(p => p == "123456785"))) .Do( x => { throw new Exception("Error while executing GetCustomerInfoBySSN 123456785"); }); }