public void ShouldDetectIfAptConfigDirectoryExistsAsFile(string file) { // Some tools seem to test for this, not sure whether it is needed. using (var gel = new GlobalLock()) { var jbd = new Cryoprison.iOS.JailbreakDetector(gel.Env, simulatorFriendly: false); gel.Env.System.IO.File.Exists = (path) => { return(path == file); }; Assert.True(jbd.IsJailbroken); } }
public void ShouldDetectIfImportantDirectoryHasBecomeASymLink(string directory) { using (var gel = new GlobalLock()) { var jbd = new Cryoprison.iOS.JailbreakDetector(gel.Env, simulatorFriendly: false); gel.Env.System.IO.Directory.Exists = (path) => { return(directory == path); }; Foundation.NSFileManager.DefaultManager.MockGetAttributes = GetAttributesReturnsSymLink; Assert.True(jbd.IsJailbroken); } }
public void ShouldNotClaimThatTheDeviceIsJailbrokenIfMobileProvisionIsEmbedded() { using (var gel = new GlobalLock()) { Foundation.NSBundle.MainBundle.MockPathForResource = (a, b) => { if (a == "embedded" && b == "mobileprovision") { return("found"); } return(null); }; var jbd = new Cryoprison.iOS.JailbreakDetector(gel.Env, simulatorFriendly: false); Assert.False(jbd.IsJailbroken); } }