38 lines
1.7 KiB
C#
38 lines
1.7 KiB
C#
using System.Linq;
|
|
using Xunit;
|
|
using ytLive.ViewModels;
|
|
|
|
namespace ytLive.Tests;
|
|
|
|
/// <summary>The MIC bay is the first bay with real controls, and it is the creator's only audio
|
|
/// control — so its wiring deserves a guard that costs nothing to run.
|
|
///
|
|
/// <para>The fader speaks dB while the model stores linear gain (that mapping is covered by
|
|
/// GainDbTests); what this pins is that the dock actually binds the dB face and the MEASURED level,
|
|
/// that the VM exposes both, and that a mute still zeroes the ladder.</para></summary>
|
|
public class MicBayTests
|
|
{
|
|
[Fact]
|
|
public void The_mic_bay_binds_the_db_fader_and_the_measured_level()
|
|
{
|
|
var dock = SourceAssert.Text("Controls", "AudioDock.xaml");
|
|
Assert.Contains("Value=\"{Binding MicVolumeDb, Mode=TwoWay}\"", dock);
|
|
Assert.Contains("Level=\"{Binding MicMeterFraction}\"", dock);
|
|
Assert.Contains("Text=\"{Binding MicVolumeDbLabel}\"", dock);
|
|
Assert.Contains("Command=\"{Binding ToggleMicMuteCommand}\"", dock);
|
|
|
|
// The fader's range is the scale's range, not an arbitrary slider span.
|
|
Assert.Contains("Minimum=\"-60\" Maximum=\"0\"", dock);
|
|
|
|
// The VM surface exists (no construction: this is a wiring check, not a behaviour one).
|
|
var type = typeof(MainViewModel);
|
|
foreach (var name in new[] { "MicVolumeDb", "MicVolumeDbLabel", "MicMeterFraction" })
|
|
Assert.NotNull(type.GetProperty(name));
|
|
|
|
// MicMuted is derived from the volume: mute is a fader position, so the ladder must follow.
|
|
var audio = SourceAssert.Text("ViewModels", "MainViewModel.Audio.cs");
|
|
Assert.Contains("MicMuted ? 0 :", audio);
|
|
Assert.Contains("OnPropertyChanged(nameof(MicMeterFraction));", audio);
|
|
}
|
|
}
|