public void ShouldCreateNoneRole() { var noRoleInActivity = RoleInActivity.None(); noRoleInActivity.Activity.ShouldBe(ActivityId.Empty); noRoleInActivity.Role.ShouldBe(DeviceRole.Idle); }
public void ShouldCreateRecordingRole(ActivityId activity) { var recordingRoleInActivity = RoleInActivity.Recording(activity); recordingRoleInActivity.Activity.ShouldBe(activity); recordingRoleInActivity.Role.ShouldBe(DeviceRole.Recording); }
public void ShouldBeRecordingWhenUsedForAudioRecording( Microphone microphone, ActivityId audioRecording) { microphone.UseForAudioRecording(audioRecording); microphone.IsInRole(RoleInActivity.Recording(audioRecording)).ShouldBeTrue(); }
public void ShouldBeRecordingWhenUsedForVideoRecording( VideoCamera videoCamera, ActivityId videoRecording) { videoCamera.UseForVideoRecording(videoRecording); videoCamera.IsInRole(RoleInActivity.Recording(videoRecording)).ShouldBeTrue(); }
/// <summary> /// Verifies if the device is in a role during an activity given by <paramref name="roleInActivty"/>. /// </summary> /// <param name="roleInActivty"> /// The role in an activity the device playsmight be part of. /// </param> /// <returns> /// <see langword="true"/>, if the device is ain the role; /// <see langword="false"/> otherwise. /// </returns> public bool IsInRole(RoleInActivity roleInActivty) { if (roleInActivty == null) { throw new ArgumentNullException(nameof(roleInActivty)); } return currentRoleInActivity == roleInActivty; }
public static void ShouldNotBeRecording(this Device self, IMediaRecording recording) { self.IsInRole(RoleInActivity.Recording(recording.ActivityId)).ShouldBeFalse(); }
/// <summary> /// Attempts to assume a role in an activty given by <paramref name="roleInActivty"/> /// </summary> /// <param name="roleInActivty"> /// The role in an activty the device should to assume. /// </param> /// <returns> /// <see langword="true"/>, if the device can assume the role; <see langword="false"/> otherwise. /// </returns> protected bool AssumeRole(RoleInActivity roleInActivty) { currentRoleInActivity = roleInActivty; return true; }
/// <summary> /// Makes the device available. /// </summary> public void MakeAvailable() { currentRoleInActivity = RoleInActivity.None(); }