@isTest
private class SearchMemberPageControllerTest {
    
    @TestSetup
    static void setup(){
        TestDataUtility.CreatePIPolicyConfigurations(new string[]{'Contact'});
    }
    
    static testMethod void testMethod1() {
    	List<RecordType> rectIE = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Customer IE'];
        
        User user = new User();
        user.LastName = 'test';
        user.FirstName = 'test';
        user.Alias = 'test';
        user.Email = 'test@test.com';
        user.Username = 'test111@test222.com';
        user.CommunityNickname = 'test1111';
        user.IsActive = true;
        user.EmailEncodingKey = 'ISO-2022-JP';
        user.TimeZoneSidKey = 'Asia/Tokyo';
        user.LocaleSidKey = 'ja_JP';
        user.LanguageLocaleKey = 'ja';
        user.ProfileId = System.Label.SystemAdmin;
        insert user;
        
        Account acc = new Account();
        acc.Name = 'test';
        acc.DivisionName__c = 'DivisionName__c';
        acc.FacilityName__c = 'FacilityName__c';
        acc.PostCode__c='000000';
        acc.stautesD__c= 'Pass';
        insert acc;
        
        Contact con = new Contact();
        con.LastName = 'test';
        con.AccountId = acc.Id;
        con.MobilePhone = 'MobilePhoneD__c';
        con.OtherPhone = 'OtherPhoneD__c';
        con.Fax = 'FaxD__c';
        con.Email = 'EmailD__c@test.com';
        con.Phone = 'PhoneD__c';
        con.Title = 'TitleD__c';
        con.Address1__c = 'Address1D__c';
        con.Address2__c = 'Address2D__c';
        con.Address3__c = 'Address3D__c';
        con.Postcode__c = '100111';
        con.ContactStatus__c = 'ContactStatusD__c';
        con.CancelReason__c = 'CancelReasonD__c';
        con.StatusD__c = 'Pass';
        insert con;

        PageReference page = new PageReference('/apex/SearchMemberPage?lineNum=1');
        System.Test.setCurrentPage(page);
        SearchMemberPageController controller = new SearchMemberPageController();
        controller.init();

        controller.searchByName = 'test';
        controller.SearchMember();

        controller.searchByAccount = 'test';
        controller.SearchMember();

        controller.searchByName = 'test';
        controller.searchByAccount = 'test';
        controller.SearchMember();

        controller.memberType = 'User';

        controller.searchByName = 'test';
        controller.SearchMember();

        controller.searchByAccount = 'test';
        controller.SearchMember();

        controller.searchByName = 'test';
        controller.searchByAccount = 'test';
        controller.SearchMember();

        controller.save();
        controller.lineList[0].check = true;
        controller.save();
    }
}