public void ImplicitCastOnAbsolutePathsShouldCreateAFileMediaSource()
        {
            var path         = "/private/var/mobile/Containers/Data/Application/B1E5AB19-F815-4B4A-AB97-BD4571D53743/Documents/temp/video.mp4";
            var mediaElement = new UI.Views.MediaElement {
                Source = path
            };

            Assert.IsInstanceOf <Core.FileMediaSource>(mediaElement.Source);
        }
        public void ImplicitCastOnWindowsAbsolutePathsShouldCreateAFileMediaSource()
        {
            var path         = "C:\\Users\\Username\\Videos\\video.mp4";
            var mediaElement = new UI.Views.MediaElement {
                Source = path
            };

            Assert.IsInstanceOf <Core.FileMediaSource>(mediaElement.Source);
        }
Beispiel #3
0
        public void TestSetStringValue()
        {
            var mediaElement = new UI.Views.MediaElement();

            mediaElement.SetValue(UI.Views.MediaElement.SourceProperty, "media.mp4");
            Assert.NotNull(mediaElement.Source);
            Assert.IsType <Core.FileMediaSource>(mediaElement.Source);
            Assert.Equal("media.mp4", ((Core.FileMediaSource)mediaElement.Source).File);
        }
        public void TestSetStringValue()
        {
            var mediaElement = new UI.Views.MediaElement();

            mediaElement.SetValue(UI.Views.MediaElement.SourceProperty, "media.mp4");

            Assert.IsNotNull(mediaElement.Source);
            Assert.IsInstanceOf <Core.FileMediaSource>(mediaElement.Source);
            Assert.AreEqual("media.mp4", ((Core.FileMediaSource?)mediaElement.Source)?.File);
        }
        public void TestImplicitStringUriConversion()
        {
            var mediaElement = new UI.Views.MediaElement {
                Source = "http://xamarin.com/media.mp4"
            };

            Assert.IsNotNull(mediaElement.Source);
            Assert.IsInstanceOf <Core.UriMediaSource>(mediaElement.Source);
            Assert.AreEqual("http://xamarin.com/media.mp4", ((Core.UriMediaSource?)mediaElement.Source)?.Uri?.AbsoluteUri);
        }
        public void TestImplicitFileConversion()
        {
            var mediaElement = new UI.Views.MediaElement {
                Source = "File.mp4"
            };

            Assert.IsNotNull(mediaElement.Source);
            Assert.IsInstanceOf <Core.FileMediaSource>(mediaElement.Source);
            Assert.AreEqual("File.mp4", ((Core.FileMediaSource?)mediaElement.Source)?.File);
        }
Beispiel #7
0
        public void TestImplicitStringUriConversion()
        {
            var mediaElement = new UI.Views.MediaElement {
                Source = "http://xamarin.com/media.mp4"
            };

            Assert.True(mediaElement.Source != null);
            Assert.IsType <Core.UriMediaSource>(mediaElement.Source);
            Assert.Equal("http://xamarin.com/media.mp4", ((Core.UriMediaSource)mediaElement.Source).Uri.AbsoluteUri);
        }
Beispiel #8
0
        public void TestImplicitFileConversion()
        {
            var mediaElement = new UI.Views.MediaElement {
                Source = "File.mp4"
            };

            Assert.True(mediaElement.Source != null);
            Assert.IsType <Core.FileMediaSource>(mediaElement.Source);
            Assert.Equal("File.mp4", ((Core.FileMediaSource)mediaElement.Source).File);
        }
Beispiel #9
0
        public void TextBindToUriValue()
        {
            var mediaElement = new UI.Views.MediaElement();

            mediaElement.SetBinding(UI.Views.MediaElement.SourceProperty, ".");
            Assert.Null(mediaElement.Source);
            mediaElement.BindingContext = new Uri("http://xamarin.com/media.mp4");
            Assert.NotNull(mediaElement.Source);
            Assert.IsType <Core.UriMediaSource>(mediaElement.Source);
            Assert.Equal("http://xamarin.com/media.mp4", ((Core.UriMediaSource)mediaElement.Source).Uri.AbsoluteUri);
        }
Beispiel #10
0
        public void TextBindToStringValue()
        {
            var mediaElement = new UI.Views.MediaElement();

            mediaElement.SetBinding(UI.Views.MediaElement.SourceProperty, ".");
            Assert.Null(mediaElement.Source);
            mediaElement.BindingContext = "media.mp4";
            Assert.NotNull(mediaElement.Source);
            Assert.IsType <Core.FileMediaSource>(mediaElement.Source);
            Assert.Equal("media.mp4", ((Core.FileMediaSource)mediaElement.Source).File);
        }
        public void TextBindToStringUriValue()
        {
            var mediaElement = new UI.Views.MediaElement();

            mediaElement.SetBinding(UI.Views.MediaElement.SourceProperty, ".");

            Assert.Null(mediaElement.Source);

            mediaElement.BindingContext = "http://xamarin.com/media.mp4";

            Assert.IsNotNull(mediaElement.Source);
            Assert.IsInstanceOf <Core.UriMediaSource>(mediaElement.Source);
            Assert.AreEqual("http://xamarin.com/media.mp4", ((Core.UriMediaSource?)mediaElement.Source)?.Uri?.AbsoluteUri);
        }
Beispiel #12
0
        public void TestBindingContextPropagation()
        {
            var context      = new object();
            var mediaElement = new UI.Views.MediaElement
            {
                BindingContext = context
            };
            var source = new MockMediaSource();

            mediaElement.Source = source;
            Assert.Same(context, source.BindingContext);

            mediaElement                = new UI.Views.MediaElement();
            source                      = new MockMediaSource();
            mediaElement.Source         = source;
            mediaElement.BindingContext = context;
            Assert.Same(context, source.BindingContext);
        }