public void ShouldConvertCustomIAudioMessageToAudioMessage() { var message = new TestAudioMessage(); var audioMessage = AudioMessage.Convert(message); Assert.AreNotEqual(message, audioMessage); Assert.AreEqual(new Uri("https://foo.url"), audioMessage.Url); Assert.AreEqual(1000, audioMessage.Duration); }
public void ShouldThrowExceptionWhenUrlIsNull() { var message = new AudioMessage() { Duration = 10000 }; ExceptionAssert.Throws <InvalidOperationException>("The url cannot be null.", () => { AudioMessage.Convert(message); }); }
public void ShouldThrowExceptionWhenDurationIsZero() { var message = new AudioMessage() { Url = new Uri("https://foo.url") }; ExceptionAssert.Throws <InvalidOperationException>("The duration should be at least 1 millisecond.", () => { AudioMessage.Convert(message); }); }
public void ShouldPreserveInstanceWhenValueIsAudioMessage() { var message = new AudioMessage() { Url = new Uri("https://foo.url"), Duration = 10000 }; var audioMessage = AudioMessage.Convert(message); Assert.AreSame(message, audioMessage); }