@isTest
private class SearchSetProductControllerTest {

    static testMethod void myUnitTest() {
        
        Product_Set__c ps = new Product_Set__c();
        Apexpages.Standardcontroller scon = new Apexpages.Standardcontroller(ps);
        SearchSetProductController controller = new SearchSetProductController(scon);
        controller.SearchName = 'aaaa';
        controller.SearchCode = 'bbbb';
        controller.serContact();
    }
    
    static testMethod void initTest() {

        Product2 product1 = new Product2( Name='11111');
        product1.SFDA_Status__c = '不要';
        product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(5);
        product1.Intra_Trade_List_RMB_1__c = 100;
        product1.Intra_Trade_List_RMB_Date1__c = date.today();
        product1.Intra_Trade_Cost_RMB_1__c = 200;
        product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
        product1.Manual_Entry__c = false;
        product1.Asset_Model_No__c = '11111';
        product1.ProductCode = 'OTV-SP1H-NA-12E';
        insert product1;
        Product_Set__c ps1 = new Product_Set__c();
        ps1.Name = 'セット品１';
        ps1.Product_Set_CD__c = '111111';
        ps1.Applicable_Department__c = '泌尿科';
        ps1.Description__c = '説明';
        ps1.Qty__c = 10;
        ps1.Invalid_Date__c  = date.today().addDays(5);
        //ps1.Valid__c = true;
        ps1.Valid_Date__c = date.today().addDays(-5);
        insert ps1;

        Product_Set_Detail__c psd1 = new Product_Set_Detail__c();
        psd1.Product_Set__c = ps1.id;
        psd1.Price__c = 100;
        psd1.Quantity__c = 10;
        psd1.Product__c = product1.id;

        insert psd1;
        //ps1 = [select name,Applicable_Department__c,Product_Set_CD__c,Price_Zero_Count__c,Invalid_Date__c from Product_Set__c where id = :ps1.id];
        //system.assertEquals( 'セット品１',ps1.name);
        //system.assertEquals( '泌尿科',ps1.Applicable_Department__c);
        //system.assertEquals( date.today().addDays(5),ps1.Invalid_Date__c);
        //system.assertEquals( '111111',ps1.Product_Set_CD__c);

        
        Apexpages.Standardcontroller scon = new Apexpages.Standardcontroller(ps1);
        SearchSetProductController controller = new SearchSetProductController(scon);
        SearchSetProductController.getlistViewOptions();
        
        controller.init();
        //system.assertEquals( '消化科',controller.listViewOptions.[1]);
        controller.SearchName = 'セット品１';
        //controller.SearchCode = '111111';
        controller.filterName = '泌尿科';
        controller.serContact();
        system.assertEquals( 1,controller.activities.size());
        controller.SelectDone();
    }
}