/*
 * Author: Guo, Aline Yaying
 * Created Date: 03/22/2022
 * Purpose: Test Class
 * History: 
 *      03/22/2022 - Guo, Aline Yaying - Initial Code.
 * 
 * */
@isTest
private class NewAndEditTenderinformationControlTest {
    static testMethod void testMethod1() {
     
        TestDataUtility.CreatePIPolicyConfiguration();
        
        Test.setMock(HttpCalloutMock.class, new TestDataUtility.CreateMetaDataUtilityHttpMock());
        Tender_information__c tenTest = TestDataUtility.CreateTenderInformation(1)[0];

        Test.startTest();
        ApexPages.StandardController con =  new ApexPages.StandardController(tenTest);
        NewAndEditTenderinformationController tender = new NewAndEditTenderinformationController(con);
        
        String tenderJson = '{"Retain_Tender__c":"a4J1m000000SDAG","Logical_delete__c":false,"InfoTitle__c":"test1","InfoType__c":"1：预告","Keywords__c":"test","XmNumber__c":"","IsReactionOpp__c":true,"BiddingType__c":"0：公开招标","OpportunityStatus__c":"草案","IsElectronic__c":"","OpportunityNum__c":"1","InfoQianlimaUrl__c":"test","TenderManageCode__c":"","IsRelateProject__c":"是","Hospital__c":"0011m00000Xm6Lk","relativeTime__c":"2022/03/29 11:46","Hospital1__c":"000000000000000","irrelevantReasons__c":"","Hospital2__c":"000000000000000","irrelevantReasonOther__c":"","Hospital3__c":"000000000000000","department_selection__c":"01210000000QemLAAS","Hospital4__c":"000000000000000","AreaProvince__c":"北京","AreaCity__c":"北京","AreaCountry__c":"","InfoPublishTime__c":"","BidingAcquireTime__c":"","TenderBeginTime__c":"","BidingEndTime__c":"","TenderEndTime__c":"","OpenBidingTime__c":"","noticeDate__c":"","ResultDate__c":"","TenderDate__c":"","publicDate__c":"2022/03/29","Bid_Winning_Date__c":"","AgentUnit1__c":"","AgentRelationName__c":"***","AgentUnit2__c":"","AgentRelationWay__c":"***********","AgentUnit3__c":"","ZhaoBiaoUnit1__c":"","ZhaoRelationName__c":"***","ZhaoBiaoUnit2__c":"","ZhaoRelationWay__c":"***********","ZhaoBiaoUnit3__c":"","IsBid__c":"","BiddingStatus__c":"","irresponsibleReason__c":"","NotBidApprovalStatus__c":"","irresponsibleReasonOther__c":"","BudgetAmount1__c":"","WinnerAmount1__c":"","BudgetAmount2__c":"","WinnerAmount2__c":"","BudgetAmount3__c":"","WinnerAmount3__c":"","OBSAP_Budget_amount__c":"","WinnerUnit__c":"","BudgetUnit__c":"","Sum__c":"","SumUnit__c":"","ZhongBiaoUnit1__c":"","ZhongRelationName__c":"***","ZhongBiaoUnit2__c":"","ZhongRelationWay__c":"***********","ZhongBiaoUnit3__c":"","IsOther__c":false,"OtherInfoTitle__c":"","otherInfo__c":"","Name":"testProject","OwnerId":"0051m0000030e0QAAQ","ProjectId__c":"","CursorMark__c":"","File_Surpass_12M__c":false,"department__c":"000000000000000","ZhongRelationName_Encrypted__c":"","AgentRelationName_Encrypted__c":"","ZhaoRelationWay_Encrypted__c":"","ZhongRelationWay_Encrypted__c":"","ZhaoRelationName_Encrypted__c":"","AgentRelationWay_Encrypted__c":"","AWS_Data_Id__c":"'+tenTest.AWS_Data_Id__c+'"}';
        NewAndEditTenderinformationController.saveTenderinformation(tenderJson,'avgwshDFcxAS',False);
        NewAndEditTenderinformationController.saveTenderinformation(tenderJson,'avgwshDFcxAS',True);

        tenTest.AWS_Data_Id__c ='';
        update tenTest;
        NewAndEditTenderinformationController.saveTenderinformation(tenderJson,'avgwshDFcxAS',False);
        Test.stopTest();
    }
}