private void Show(ITraktNotification notification, TimeSpan duration)
 {
     Notification = notification;
     ServiceRegistration.Get <ISuperLayerManager>().ShowSuperLayer(notification.SuperLayerScreenName, duration);
 }
Esempio n. 2
0
 private void ShowNotification(ITraktNotification notification, TimeSpan duration)
 {
     _mediaPortalServices.GetTraktNotificationModel().ShowNotification(notification, duration);
 }
 public void ShowNotification(ITraktNotification notification, TimeSpan duration)
 {
     Instance.Show(notification, duration);
 }
        public void StartScrobble(TraktPluginSettings settings, MediaItem mediaItem, ITraktClient traktClient, ITraktNotification notification)
        {
            // Arrange
            IMediaPortalServices mediaPortalServices = Substitute.For <IMediaPortalServices>();

            mediaPortalServices.GetTraktUserHomePath().Returns(DataPath);
            SetSettings(mediaPortalServices, settings);
            SetPlayerAndContentDirForMovie(mediaPortalServices, mediaItem);

            IAsynchronousMessageQueue messageQueue = GetMockedMsgQueue(mediaPortalServices);

            IFileOperations fileOperations = Substitute.For <IFileOperations>();

            fileOperations.FileExists(Path.Combine(DataPath, FileName.Authorization.Value)).Returns(true);

            TraktScrobbleHandlerManager      traktScrobbleHandler = new TraktScrobbleHandlerManager(mediaPortalServices, traktClient, fileOperations);
            TraktScrobbleStartedNotification expectedNotification = (TraktScrobbleStartedNotification)notification;

            // Act
            // start the player
            messageQueue.MessageReceivedProxy += Raise.Event <MessageReceivedHandler>(new AsynchronousMessageQueue(new object(), new[] { "PlayerManager" }),
                                                                                      GetSystemMessageForMessageType(PlayerManagerMessaging.MessageType.PlayerStarted));

            // Assert
            mediaPortalServices.GetTraktNotificationModel().Received()
            .ShowNotification(Arg.Is <TraktScrobbleStartedNotification>(x => x.IsSuccess == expectedNotification.IsSuccess &&
                                                                        x.Message == expectedNotification.Message &&
                                                                        x.ActionType == expectedNotification.ActionType &&
                                                                        x.Progress == expectedNotification.Progress &&
                                                                        x.SuperLayerScreenName == expectedNotification.SuperLayerScreenName),
                              Arg.Any <TimeSpan>());
        }