Public Access
110 lines
4.6 KiB
C#
110 lines
4.6 KiB
C#
using MeetingAssistant.LaunchProfiles;
|
|
using MeetingAssistant.Recording;
|
|
using MeetingAssistant.Taskbar;
|
|
|
|
namespace MeetingAssistant.Tests;
|
|
|
|
public sealed class TaskbarIconTests
|
|
{
|
|
[Fact]
|
|
public void IdleMenuOffersStartForEachConfiguredProfile()
|
|
{
|
|
var menu = MeetingTaskbarMenuBuilder.Build(
|
|
Status(),
|
|
[Profile("default", "Ctrl+Alt+M"), Profile("english", "Ctrl+Alt+E")]);
|
|
|
|
Assert.Equal(RecordingProcessState.Idle, menu.State);
|
|
Assert.Contains(menu.Items, item =>
|
|
item.Action == MeetingTaskbarAction.EditRules &&
|
|
item.Text == "Edit rules and identities");
|
|
Assert.Contains(menu.Items, item =>
|
|
item.Action == MeetingTaskbarAction.StartRecording &&
|
|
item.ProfileName == "default" &&
|
|
item.Text == "Start meeting recording (default)\tCtrl+Alt+M");
|
|
Assert.Contains(menu.Items, item =>
|
|
item.Action == MeetingTaskbarAction.StartRecording &&
|
|
item.ProfileName == "english" &&
|
|
item.Text == "Start meeting recording (english)\tCtrl+Alt+E");
|
|
Assert.DoesNotContain(menu.Items, item => item.Action == MeetingTaskbarAction.StopRecording);
|
|
Assert.DoesNotContain(menu.Items, item => item.Action == MeetingTaskbarAction.AbortRecording);
|
|
}
|
|
|
|
[Fact]
|
|
public void RecordingMenuOffersStopAbortAndOtherProfileSwitches()
|
|
{
|
|
var menu = MeetingTaskbarMenuBuilder.Build(
|
|
Status(isRecording: true, state: RecordingProcessState.Recording, profile: "default"),
|
|
[Profile("default", "Ctrl+Alt+M"), Profile("english", "Ctrl+Alt+E"), Profile("french", "Ctrl+Alt+F")]);
|
|
|
|
Assert.Equal(RecordingProcessState.Recording, menu.State);
|
|
Assert.Contains(menu.Items, item => item.Action == MeetingTaskbarAction.StopRecording);
|
|
Assert.Contains(menu.Items, item => item.Action == MeetingTaskbarAction.AbortRecording);
|
|
Assert.Contains(menu.Items, item =>
|
|
item.Action == MeetingTaskbarAction.SwitchProfile &&
|
|
item.ProfileName == "english" &&
|
|
item.Text == "Switch to english\tCtrl+Alt+E");
|
|
Assert.Contains(menu.Items, item =>
|
|
item.Action == MeetingTaskbarAction.SwitchProfile &&
|
|
item.ProfileName == "french" &&
|
|
item.Text == "Switch to french\tCtrl+Alt+F");
|
|
Assert.DoesNotContain(menu.Items, item =>
|
|
item.Action == MeetingTaskbarAction.SwitchProfile &&
|
|
item.ProfileName == "default");
|
|
Assert.DoesNotContain(menu.Items, item => item.Action == MeetingTaskbarAction.StartRecording);
|
|
}
|
|
|
|
[Fact]
|
|
public void ProcessingMenuShowsSummarizingButAllowsStartingNewRecordings()
|
|
{
|
|
var menu = MeetingTaskbarMenuBuilder.Build(
|
|
Status(state: RecordingProcessState.Summarizing, profile: "default"),
|
|
[Profile("default"), Profile("english")]);
|
|
|
|
Assert.Equal(RecordingProcessState.Summarizing, menu.State);
|
|
Assert.Contains(menu.Items, item =>
|
|
item.Action == MeetingTaskbarAction.StartRecording &&
|
|
item.ProfileName == "default");
|
|
Assert.Contains(menu.Items, item =>
|
|
item.Action == MeetingTaskbarAction.StartRecording &&
|
|
item.ProfileName == "english");
|
|
Assert.DoesNotContain(menu.Items, item => item.Action == MeetingTaskbarAction.StopRecording);
|
|
Assert.DoesNotContain(menu.Items, item => item.Action == MeetingTaskbarAction.AbortRecording);
|
|
}
|
|
|
|
[Fact]
|
|
public void RecordingStateWinsOverOlderSummarizingWork()
|
|
{
|
|
var menu = MeetingTaskbarMenuBuilder.Build(
|
|
Status(isRecording: true, state: RecordingProcessState.Recording, profile: "english"),
|
|
[Profile("default"), Profile("english")]);
|
|
|
|
Assert.Equal(RecordingProcessState.Recording, menu.State);
|
|
}
|
|
|
|
private static LaunchProfile Profile(string name, string hotkey = "")
|
|
{
|
|
return new LaunchProfile(name, new MeetingAssistantOptions
|
|
{
|
|
Hotkey =
|
|
{
|
|
Toggle = hotkey
|
|
}
|
|
});
|
|
}
|
|
|
|
private static RecordingStatus Status(
|
|
bool isRecording = false,
|
|
RecordingProcessState state = RecordingProcessState.Idle,
|
|
string? profile = null)
|
|
{
|
|
return new RecordingStatus(
|
|
isRecording,
|
|
state == RecordingProcessState.Idle ? null : "transcript.md",
|
|
state == RecordingProcessState.Idle ? null : "meeting.md",
|
|
state == RecordingProcessState.Idle ? null : "context.md",
|
|
state == RecordingProcessState.Idle ? null : "summary.md",
|
|
state,
|
|
profile);
|
|
}
|
|
}
|