public TrackPage(TrackViewModel tvm)
        {
            InitializeComponent();

            if (tvm == null)
            {
                SetControlsVisible(Visibility.Hidden);
                return;
            }

            var trackRepo     = new TrackRepository();
            var previewSource = trackRepo.GetPreviewSource(tvm.TrackId);

            this.DataContext = _vm = new TrackPageViewModel
            {
                Artist       = tvm.Artist,
                Title        = tvm.Title,
                Image        = tvm.Image,
                AudioTrack   = previewSource,
                Playtime     = tvm.PlayTime,
                Popularity   = tvm.Popularity,
                DiscNumber   = tvm.DiscNumber,
                LicensorName = tvm.LicensorName,
                LabelName    = tvm.LabelName,
                ReleaseDate  = tvm.ReleaseDate,
                PackageType  = tvm.PackageType,
                Price        = tvm.Price
            };

            StopTrack();
        }
示例#2
0
        public TrackPage()
        {
            this.vm = App.ServiceProvider.GetService <TrackPageViewModel>();

            this.InitializeComponent();

            DataContext = vm;
        }
        public void Test_Search_Method()
        {
            //Arange
            var navigationService = new Mock <ICustomNavigation>().Object;
            var projectAppService = new Mock <IProjectAppService>().Object;
            var TrackViewModel    = new TrackPageViewModel(navigationService, projectAppService);

            //Act
            var result = TrackViewModel.LoadSearchData();

            //Assert
            Assert.IsNotNull(result);
        }
        public void TheElementGetsAdded()
        {
            TrackDTO dto = new TrackDTO()
            {
                Id = 42
            };
            var mock = new Mock <ITrackRepository>();

            mock.Setup(a => a.Find(42)).ReturnsAsync(dto);
            var view = new TrackPageViewModel(mock.Object);

            view.EmptyAndAdd(42);
            Assert.True(view.Track.First().Id == 42);
        }
        public void TestThatThereIsAlways1()
        {
            TrackDTO dto = new TrackDTO()
            {
                Id = 42
            };
            var mock = new Mock <ITrackRepository>();

            mock.Setup(a => a.Find(42)).ReturnsAsync(dto);
            var view = new TrackPageViewModel(mock.Object);

            view.EmptyAndAdd(42);
            Assert.True(view.Track.Count() == 1);
        }
        public void NavigateTrackPageToAudioPage_Test()
        {
            //arrange
            ICustomNavigation  navigation = SimpleIoc.Default.GetInstance <ICustomNavigation>();
            IProjectAppService appService = new Mock <IProjectAppService>().Object;

            TrackPageViewModel trackPage = new TrackPageViewModel(navigation, appService);

            Track track = new Track()
            {
                id            = "test",
                name          = "test",
                duration      = 4,
                artist_id     = "test",
                artist_name   = "test",
                artist_idstr  = "test",
                album_name    = "test",
                album_id      = "test",
                license_ccurl = "test",
                position      = 1,
                releasedate   = "test",
                album_image   = "test",
                audio         = "test",
                audiodownload = "test",
                prourl        = "test",
                shorturl      = "test",
                shareurl      = "test",
                waveform      = "test",
                image         = "test",
            };

            //act
            trackPage.SelectedTrack = track;


            //assert
            Assert.AreEqual <string>(Locator.AudioPage, navigation.CurrentPageKey);
        }
示例#7
0
 /// <summary>OnNavigatedTo</summary>
 /// <param name="e">Navigation Event Args</param>
 protected override void OnNavigatedTo(
     NavigationEventArgs e) =>
 DataContext = new TrackPageViewModel(
     SpotifySdk.Instance.Client, (string)e.Parameter);
示例#8
0
 public TrackPage()
 {
     InitializeComponent();
     trackPageViewModel = new TrackPageViewModel();
     DataContext        = trackPageViewModel;
 }