コード例 #1
0
            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);
            }
コード例 #2
0
            public void ShouldThrowExceptionWhenUrlIsNull()
            {
                var message = new AudioMessage()
                {
                    Duration = 10000
                };

                ExceptionAssert.Throws <InvalidOperationException>("The url cannot be null.", () =>
                {
                    AudioMessage.Convert(message);
                });
            }
コード例 #3
0
            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);
                });
            }
コード例 #4
0
            public void ShouldPreserveInstanceWhenValueIsAudioMessage()
            {
                var message = new AudioMessage()
                {
                    Url      = new Uri("https://foo.url"),
                    Duration = 10000
                };

                var audioMessage = AudioMessage.Convert(message);

                Assert.AreSame(message, audioMessage);
            }