function fieldsToUpdate = getDefaultTestCaseAndFieldsToFix(sldvData, simData, ignoreExpectedOutput)        
%

%   Copyright 2011-2018 The MathWorks, Inc.

    if nargin < 3
        ignoreExpectedOutput = false;
    end

    if isfield(sldvData,'LoggedTestUnitInfo')
        loggedTestUnitInfo = sldvData.LoggedTestUnitInfo;
        if isfield(loggedTestUnitInfo,'ModelBlock')
            loggedModelInfo = loggedTestUnitInfo.ModelBlock.ReferencedModel;
        elseif isfield(loggedTestUnitInfo,'SldvHarnessModel')   
            loggedModelInfo = loggedTestUnitInfo.SldvHarnessModel.TestUnitModel;
        else           
            loggedModelInfo = loggedTestUnitInfo.SubsystemLogging.TestSubsystem;
        end
        inportInfo = loggedModelInfo.InputPortInfo;        
    elseif isfield(sldvData, 'DerivedDataInfo')
        inportInfo = sldvData.DerivedDataInfo.InputPortInfo;
    else            
        inportInfo = sldvData.AnalysisInformation.InputPortInfo;        
    end                                            
    
    fieldsInfo.name = 'dataValues';
    fieldsInfo.portInfo = inportInfo;        
    fieldsToUpdate = {fieldsInfo};        
    
    if isfield(simData,'expectedOutput') && ~ignoreExpectedOutput
        outportInfo = sldvData.AnalysisInformation.OutputPortInfo;
        fieldsInfo.name = 'expectedOutput';
        fieldsInfo.portInfo = outportInfo;        
        fieldsToUpdate(end+1) = {fieldsInfo};
    end    
end
