public void ThrowsArgumentExceptionIfGuidIsGarbage() { var settings = new CoreSettings { LockRemoteControl = false }; var accessControl = new AccessControl(settings); Assert.Throws <ArgumentException>(() => accessControl.ObserveAccessPermission(new Guid())); }
public void UpdatesOnlyRemoteAccessPermissions() { var settings = new CoreSettings { LockRemoteControl = true, RemoteControlPassword = null }; var accessControl = new AccessControl(settings); Guid localToken = accessControl.RegisterLocalAccessToken(); Guid remoteToken = accessControl.RegisterRemoteAccessToken(new Guid()); var remotePermissions = accessControl.ObserveAccessPermission(remoteToken).CreateCollection(); accessControl.SetRemotePassword(localToken, "password"); Assert.Equal(AccessPermission.Admin, accessControl.ObserveAccessPermission(localToken).FirstAsync().Wait()); Assert.Equal(new[] { AccessPermission.Admin, AccessPermission.Guest }, remotePermissions); }
public void SmokeTest() { var settings = new CoreSettings { LockRemoteControl = false }; var accessControl = new AccessControl(settings); Guid token = accessControl.RegisterLocalAccessToken(); var permissions = accessControl.ObserveAccessPermission(token).CreateCollection(); accessControl.SetLocalPassword(token, "password"); accessControl.DowngradeLocalAccess(token); accessControl.UpgradeLocalAccess(token, "password"); Assert.Equal(new[] { AccessPermission.Admin, AccessPermission.Guest, AccessPermission.Admin }, permissions); }
public void UpdatesRemoteAccessWhenLockRemoteSettingChanges() { var settings = new CoreSettings { LockRemoteControl = false }; var accessControl = new AccessControl(settings); Guid remoteToken = accessControl.RegisterRemoteAccessToken(new Guid()); Guid adminToken = accessControl.RegisterLocalAccessToken(); var permissions = accessControl.ObserveAccessPermission(remoteToken).CreateCollection(); settings.LockRemoteControl = true; accessControl.SetRemotePassword(adminToken, "password"); settings.LockRemoteControl = false; settings.LockRemoteControl = true; Assert.Equal(new[] { AccessPermission.Admin, AccessPermission.Guest, AccessPermission.Admin, AccessPermission.Guest }, permissions); }
public void ThrowsArgumentExceptionIfGuidIsGarbage() { var settings = new CoreSettings { LockRemoteControl = false }; var accessControl = new AccessControl(settings); Assert.Throws<ArgumentException>(() => accessControl.ObserveAccessPermission(new Guid())); }