There are some things I would change about your code.
- I would create an account and contact record in your test method so you don't have to rely on the data in your system.
A good idea is to use the @testSetup syntax to create a setup method. You can find more information at the following link: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_testsetup_using.htm
- You can use the System.assertEquals(expected, actual, msg) method to check if you are getting the right values from your code. You can find more information about this method from this link: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_system.htm
So something close to the following should be what you are looking for:
@isTest
public class WR1test {
@testSetup static void setup(){
Account acc = new Account(name='Test Account');
insert acc;
Contact con = new Contact(FirstName='Test', LastName='Contact', AccountId=acc.Id);
insert con;
}
static testMethod void WR1tst(){
List <Account> acc = new List <Account>();
List <Contact> con = new List <Contact>();
acc = [select name, id from Account limit 1];
con = [select LastName, id from Contact limit 1];
String AName = acc.Name;
String AId = acc.Id;
String CLastName = con.LastName;
String CId con.Id;
List<WR1.wrapper> wrapperList = new List<WR1.wrapper>();
List<WR1.wrapper> expectedList = new List<WR1.wrapper>();
WR1 testWR1 = new WR1();
wrapperList = testWR1.getLstwrapperIntString();
WR1.wrapper testwrapper=new WR1.wrapper(AName,AId,CLastName,CId);
expectedList.add(testwrapper);
System.assertEquals(expectedList, wrapperList, 'Got expected result');
}
}