I am not sure how to create multiple profiles for one hierarchy custom setting. I assume it would look something like this:
ConcurrentSessionsPolicyLimit__c defaultLimit = new ConcurrentSessionsPolicyLimit__c();
defaultLimit.Login_Attempts_Limit__c = 1;
defaultLimit.Name= 'ConcurrentSessionsPolicyLimit';
defaultLimit.SetupOwnerId=Userinfo.getUserId();
insert defaultLimit;
defaultLimit = new ConcurrentSessionsPolicyLimit__c(Id = defaultLimit.Id, Name = 'System Administrator', Login_Attempts_Limit__c= 5);
defaultLimit = new ConcurrentSessionsPolicyLimit__c(Id = defaultLimit.Id, Name = 'Campaign Manager', Login_Attempts_Limit__c = 2);
update defaultLimit;
but when I do this, I am returned 4 ConcurrentSessionsPolicyLimit__c and they are being overwritten. I am not upserting the test data correctly, can anyone correct what I am doing wrong? Do I need to explicitly set defaultLimit[0] = _______?
or defaultLimit.add(___?);
I have done a fair amount of googling and it all points to a single instance of the hierarchy custom setting.