Fix ms-winsoundevent
This commit is contained in:
Родитель
e407e07171
Коммит
80f7871dbe
|
@ -355,7 +355,7 @@ namespace Microsoft.Toolkit.Uwp.Notifications
|
||||||
bool? silent = default)
|
bool? silent = default)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (!src.IsFile)
|
if (!src.IsFile && src.Scheme != "ms-winsoundevent")
|
||||||
{
|
{
|
||||||
throw new ArgumentException(nameof(src), "Audio Source has to be a file.");
|
throw new ArgumentException(nameof(src), "Audio Source has to be a file.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -548,6 +548,45 @@ namespace UnitTests.Notifications
|
||||||
Assert.AreEqual(testToastAudioSilent, builder.Content.Audio.Silent);
|
Assert.AreEqual(testToastAudioSilent, builder.Content.Audio.Silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void AddAudioTest_WithMsWinSoundEvent_ReturnSelfWithCustomAudioAdded()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
Uri testAudioUriSrc = new Uri("ms-winsoundevent:Notification.Reminder");
|
||||||
|
|
||||||
|
// Act
|
||||||
|
ToastContentBuilder builder = new ToastContentBuilder();
|
||||||
|
ToastContentBuilder anotherReference = builder.AddAudio(testAudioUriSrc);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreSame(builder, anotherReference);
|
||||||
|
Assert.AreEqual(testAudioUriSrc.OriginalString, builder.Content.Audio.Src.OriginalString);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
[ExpectedException(typeof(ArgumentException))]
|
||||||
|
public void AddAudioTest_WithInvalidMsUri_ThrowException()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
Uri testAudioUriSrc = new Uri("ms-doesntexist:Notification.Reminder");
|
||||||
|
|
||||||
|
// Act
|
||||||
|
ToastContentBuilder builder = new ToastContentBuilder();
|
||||||
|
builder.AddAudio(testAudioUriSrc);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
[ExpectedException(typeof(ArgumentException))]
|
||||||
|
public void AddAudioTest_WithInvalidHttpUri_ThrowException()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
Uri testAudioUriSrc = new Uri("https://myaudio.com/song.mp3");
|
||||||
|
|
||||||
|
// Act
|
||||||
|
ToastContentBuilder builder = new ToastContentBuilder();
|
||||||
|
builder.AddAudio(testAudioUriSrc);
|
||||||
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void AddAudioTest_WithAudioObject_ReturnSelfWithCustomAudioAdded()
|
public void AddAudioTest_WithAudioObject_ReturnSelfWithCustomAudioAdded()
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче