Created
March 22, 2020 06:50
-
-
Save saicharanreddyk/cd70de6ded7f9c97079852c78230bccb to your computer and use it in GitHub Desktop.
AccountServiceTest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IsTest | |
private class AccountServiceTest { | |
@IsTest | |
static void should_create_account() { | |
String acctName = 'Salesforce'; | |
String acctNumber = 'SFDC'; | |
String tickerSymbol = 'CRM'; | |
Test.startTest(); | |
AccountService service = new AccountService(); | |
Account newAcct = service.createAccount( acctName, acctNumber, tickerSymbol ); | |
insert newAcct; | |
Test.stopTest(); | |
List<Account> accts = [ SELECT Id, Name, AccountNumber, TickerSymbol FROM Account WHERE Id = :newAcct.Id ]; | |
System.assertEquals( 1, accts.size(), 'should have found new account' ); | |
System.assertEquals( acctName, accts[0].Name, 'incorrect name' ); | |
System.assertEquals( acctNumber, accts[0].AccountNumber, 'incorrect account number' ); | |
System.assertEquals( tickerSymbol, accts[0].TickerSymbol, 'incorrect ticker symbol' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment