public async Task SavePresentation_WithPresentationIdLessThanOne_ShouldThrowException() { // Arrange var queuePresentationAddedMock = new Mock <PresentationAddedQueue>(); var queueScheduleAddedMock = new Mock <PresentationScheduleAddedQueue>(); var presentationRepositoryMock = new Mock <IPresentationRepository>(); presentationRepositoryMock.Setup(presentationRepository => presentationRepository.SavePresentationAsync(It.IsAny <Presentation>())); var presentationManager = new PresentationManager(presentationRepositoryMock.Object, queuePresentationAddedMock.Object, queueScheduleAddedMock.Object); var presentation = new Presentation { PresentationId = 0, Abstract = "Abstract", Title = "Title", PowerpointUri = "PowerpointUri" }; // Act var ex = await Assert.ThrowsAsync <ArgumentOutOfRangeException>(() => presentationManager.SavePresentationAsync(presentation)); // Assert Assert.Equal("presentation", ex.ParamName); Assert.Equal("The presentation id can not be less than 1 (Parameter 'presentation')", ex.Message); }
/// <summary> /// Logs in a user when one is selected /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> async void ItemsList_ItemInvoked(object sender, ItemEventArgs <object> e) { var model = (UserDtoViewModel)e.Argument; var user = model.User; if (user.HasPassword) { await NavigationManager.Navigate(new ManualLoginPage(user.Name, ChkAutoLogin.IsChecked, SessionManager, PresentationManager)); return; } try { await SessionManager.Login(user.Name, string.Empty, (bool)ChkAutoLogin.IsChecked); } catch (Exception ex) { PresentationManager.ShowMessage(new MessageBoxInfo { Caption = "Login Failure", Text = ex.Message, Icon = MessageBoxIcon.Error }); } }
private async Task NavigateToYearsInternal() { var item = await GetRootFolder(); var displayPreferences = await PresentationManager.GetDisplayPreferences("MovieYears", CancellationToken.None); var yearIndex = await ApiClient.GetYearIndex(_sessionManager.CurrentUser.Id, new[] { "Movie" }, CancellationToken.None); var indexOptions = yearIndex.Where(i => !string.IsNullOrEmpty(i.Name)).OrderByDescending(i => i.Name).Select(i => new TabItem { Name = i.Name, DisplayName = i.Name }); var options = new ListPageConfig { IndexOptions = indexOptions.ToList(), PageTitle = "Movies", CustomItemQuery = GetMoviesByYear }; SetDefaults(options); options.DefaultViewType = ListViewTypes.PosterStrip; var page = new FolderPage(item, displayPreferences, ApiClient, _imageManager, PresentationManager, _navService, _playbackManager, _logger, _serverEvents, options) { ViewType = ViewType.Movies }; await _navService.Navigate(page); }
private async void LoadViewModels() { PresentationManager.ShowLoadingAnimation(); var cancellationSource = _mainViewCancellationTokenSource = new CancellationTokenSource(); try { var view = await ApiClient.GetGamesView(_sessionManager.CurrentUser.Id, ParentId, cancellationSource.Token); _gamesView = view; LoadSpotlightViewModel(view); LoadGameSystemsViewModel(view); LoadMultiPlayerViewModel(view); LoadRecentlyPlayedViewModel(view); } catch (Exception ex) { _logger.ErrorException("Error getting games view", ex); PresentationManager.ShowDefaultErrorMessage(); } finally { PresentationManager.HideLoadingAnimation(); DisposeMainViewCancellationTokenSource(false); } }
private async void ReloadReviews() { var cancellationTokenSource = _reviewsCancellationTokenSource = new CancellationTokenSource(); try { var result = await ApiClient.GetCriticReviews(_itemId, cancellationTokenSource.Token); _listItems.Clear(); _listItems.AddRange(result.Items.Where(i => !string.IsNullOrEmpty(i.Caption)).Select(i => new ItemReviewViewModel { Review = i })); } catch (Exception) { PresentationManager.ShowDefaultErrorMessage(); } finally { cancellationTokenSource.Dispose(); if (cancellationTokenSource == _reviewsCancellationTokenSource) { _reviewsCancellationTokenSource = null; } } }
public async Task SaveScheduledPresentation_WithNullPresentation_ShouldThrowException() { // Arrange var queuePresentationAddedMock = new Mock <PresentationAddedQueue>(); var queueScheduleAddedMock = new Mock <PresentationScheduleAddedQueue>(); var presentationRepositoryMock = new Mock <IPresentationRepository>(); presentationRepositoryMock .Setup(presentationRepository => presentationRepository.SaveScheduledPresentationAsync(It.IsAny <ScheduledPresentation>())); var presentationManager = new PresentationManager(presentationRepositoryMock.Object, queuePresentationAddedMock.Object, queueScheduleAddedMock.Object); var scheduledPresentation = new ScheduledPresentation { Presentation = null }; // Act var ex = await Assert.ThrowsAsync <ArgumentNullException>(() => presentationManager.SaveScheduledPresentationAsync(scheduledPresentation)); // Assert Assert.Equal("Presentation", ex.ParamName); Assert.Equal("The presentation can not be null (Parameter 'Presentation')", ex.Message); }
public async Task SaveScheduledPresentation_WithStartTimeGreaterThanEndTime_ShouldThrowException() { // Arrange var queuePresentationAddedMock = new Mock <PresentationAddedQueue>(); var queueScheduleAddedMock = new Mock <PresentationScheduleAddedQueue>(); var presentationRepositoryMock = new Mock <IPresentationRepository>(); presentationRepositoryMock .Setup(presentationRepository => presentationRepository.SaveScheduledPresentationAsync(It.IsAny <ScheduledPresentation>())); var presentationManager = new PresentationManager(presentationRepositoryMock.Object, queuePresentationAddedMock.Object, queueScheduleAddedMock.Object); var startTime = DateTime.Now; var scheduledPresentation = new ScheduledPresentation { Presentation = new Presentation(), StartTime = startTime, EndTime = startTime.AddMinutes(-1) }; // Act var ex = await Assert.ThrowsAsync <ArgumentOutOfRangeException>(() => presentationManager.SaveScheduledPresentationAsync(scheduledPresentation)); // Assert Assert.Equal("StartTime", ex.ParamName); Assert.Equal(startTime, ex.ActualValue); Assert.StartsWith( "The start time of the presentation can not be greater then the end time (Parameter 'StartTime')", ex.Message); }
private async Task NavigateToTrailersInternal() { var item = await ApiClient.GetRootFolderAsync(_sessionManager.CurrentUser.Id); var displayPreferences = await PresentationManager.GetDisplayPreferences("Trailers", CancellationToken.None); var options = new ListPageConfig { SortOptions = GetMovieSortOptions(), PageTitle = "Trailers", CustomItemQuery = GetTrailers }; SetDefaults(options); options.DefaultViewType = ListViewTypes.PosterStrip; var page = new FolderPage(item, displayPreferences, ApiClient, _imageManager, _sessionManager, PresentationManager, _navService, _playbackManager, _logger, _serverEvents, options) { ViewType = ViewType.Movies }; await _navService.Navigate(page); }
public async Task SavePresentation_WithNullAbstract_ShouldThrowException() { // Arrange var queuePresentationAddedMock = new Mock <PresentationAddedQueue>(); var queueScheduleAddedMock = new Mock <PresentationScheduleAddedQueue>(); var presentationRepositoryMock = new Mock <IPresentationRepository>(); presentationRepositoryMock.Setup(presentationRepository => presentationRepository.SavePresentationAsync(It.IsAny <Presentation>())); var presentationManager = new PresentationManager(presentationRepositoryMock.Object, queuePresentationAddedMock.Object, queueScheduleAddedMock.Object); var presentation = new Presentation { PresentationId = 1, Abstract = null, Title = "Title", PowerpointUri = "PowerpointUri" }; // Act var ex = await Assert.ThrowsAsync <ArgumentNullException>(() => presentationManager.SavePresentationAsync(presentation)); // Assert Assert.Equal("Abstract", ex.ParamName); Assert.Equal("The Abstract of the presentation can not be null (Parameter 'Abstract')", ex.Message); }
private async void LoadViewModels() { PresentationManager.ShowLoadingAnimation(); var cancellationSource = _mainViewCancellationTokenSource = new CancellationTokenSource(); try { var view = await ApiClient.GetMovieView(_sessionManager.CurrentUser.Id, cancellationSource.Token); LoadSpotlightViewModel(view); LoadBoxsetsViewModel(view); LoadTrailersViewModel(view); LoadAllMoviesViewModel(view); LoadHDMoviesViewModel(view); LoadFamilyMoviesViewModel(view); Load3DMoviesViewModel(view); LoadComedyMoviesViewModel(view); LoadRomanticMoviesViewModel(view); LoadActorsViewModel(view); LoadMiniSpotlightsViewModel(view); LoadMiniSpotlightsViewModel2(view); } catch (Exception ex) { _logger.ErrorException("Error getting movie view", ex); PresentationManager.ShowDefaultErrorMessage(); } finally { PresentationManager.HideLoadingAnimation(); DisposeMainViewCancellationTokenSource(false); } }
void Start() { // Initialize all utility script instances, so we don't have to refer to actual game objects drawLineManager = DrawLineManager.Instance; vrFileBrowser = VRFileBrowser.Instance; presentationManager = PresentationManager.Instance; }
public async Task SaveScheduledPresentation_WithValidScheduledPresentation_ShouldReturnScheduledPresentation() { // Arrange var queuePresentationAddedMock = new Mock <PresentationAddedQueue>(); var queueScheduleAddedMock = new Mock <PresentationScheduleAddedQueue>(); var presentationRepositoryMock = new Mock <IPresentationRepository>(); presentationRepositoryMock .Setup(presentationRepository => presentationRepository.SaveScheduledPresentationAsync(It.IsAny <ScheduledPresentation>())) .ReturnsAsync((ScheduledPresentation scheduledPresentationInput) => scheduledPresentationInput); var presentationManager = new PresentationManager(presentationRepositoryMock.Object, queuePresentationAddedMock.Object, queueScheduleAddedMock.Object); var startTime = DateTime.Now; var scheduledPresentation = new ScheduledPresentation { Presentation = new Presentation(), StartTime = startTime, EndTime = startTime.AddMinutes(1) }; // Act var savedScheduledPresentation = await presentationManager.SaveScheduledPresentationAsync(scheduledPresentation); // Assert Assert.NotNull(savedScheduledPresentation); Assert.NotNull(savedScheduledPresentation.Presentation); Assert.Equal(scheduledPresentation.StartTime, savedScheduledPresentation.StartTime); Assert.Equal(scheduledPresentation.EndTime, savedScheduledPresentation.EndTime); }
protected void SelfRegister(System.Web.UI.UserControl control) { if (control != null && control is IView) { object[] attributes = control.GetType().GetCustomAttributes(typeof(PresenterTypeAttribute), true); if (attributes != null && attributes.Length > 0) { foreach (Attribute viewAttribute in attributes) { if (viewAttribute is PresenterTypeAttribute) { //Had to grab the application context that gets created in the global.asax and shoved into the httpcontext.current.items collection. In order to use it I have to assign it to the ISessionProvider because presenters have no knowledge of httpcontext. var sessionProvider = new WebSessionProvider(); SessionManager.Current = sessionProvider; //if (HttpContext.Current.Items[ResourceStrings.Session_ApplicationContext] != null) //{ // SessionManager.Current[ResourceStrings.Session_ApplicationContext] = (ApplicationContext)HttpContext.Current.Items[ResourceStrings.Session_ApplicationContext]; //} PresentationManager.RegisterView((viewAttribute as PresenterTypeAttribute).PresenterType, control as IView, sessionProvider); if (SecurityContextManager.Current == null) { SecurityContextManager.Current = new WebSecurityContext(); } break; } } } } }
private async void LoadViewModels() { PresentationManager.ShowLoadingAnimation(); var cancellationSource = _mainViewCancellationTokenSource = new CancellationTokenSource(); try { var view = await ApiClient.GetMovieView(_sessionManager.CurrentUser.Id, ParentId, cancellationSource.Token); _moviesView = view; LoadSpotlightViewModel(view); LoadAllMoviesViewModel(view); LoadMiniSpotlightsViewModel(view); LoadLatestMoviesViewModel(view); LoadLatestTrailersViewModel(view); LatestMoviesViewModel.CurrentItemUpdated += LatestMoviesViewModel_OnCurrentItemUpdated; LatestTrailersViewModel.CurrentItemUpdated += LatestTrailersViewModel_OnCurrentItemUpdated; MiniSpotlightsViewModel.CurrentItemUpdated += MiniSpotlightsViewModel_OnCurrentItemUpdated; } catch (Exception ex) { _logger.ErrorException("Error getting movie view", ex); PresentationManager.ShowDefaultErrorMessage(); } finally { PresentationManager.HideLoadingAnimation(); DisposeMainViewCancellationTokenSource(false); } }
public async Task GetScheduledPresentation_ShouldReturnAScheduledPresentations() { // Arrange var queuePresentationAddedMock = new Mock <PresentationAddedQueue>(); var queueScheduleAddedMock = new Mock <PresentationScheduleAddedQueue>(); var presentationRepositoryMock = new Mock <IPresentationRepository>(); presentationRepositoryMock .Setup(presentationRepository => presentationRepository.GetScheduledPresentationAsync(It.IsAny <int>())) .ReturnsAsync(new ScheduledPresentation { ScheduledPresentationId = 1, AttendeeCount = 1, Presentation = new Presentation() }); var presentationManager = new PresentationManager(presentationRepositoryMock.Object, queuePresentationAddedMock.Object, queueScheduleAddedMock.Object); // Act var scheduledPresentation = await presentationManager.GetScheduledPresentationAsync(1); // Assert Assert.NotNull(scheduledPresentation); Assert.NotNull(scheduledPresentation.Presentation); Assert.Equal(1, scheduledPresentation.ScheduledPresentationId); Assert.Equal(1, scheduledPresentation.AttendeeCount); }
private async Task NavigateToMultiPlayerGamesInternal() { var item = await GetRootFolder(); var displayPreferences = await PresentationManager.GetDisplayPreferences("MultiPlayerGames", CancellationToken.None); var playerIndex = await ApiClient.GetGamePlayerIndex(_sessionManager.CurrentUser.Id, CancellationToken.None); var indexOptions = playerIndex.Where(i => !string.IsNullOrEmpty(i.Name) && int.Parse(i.Name) > 1).Select(i => new TabItem { Name = i.Name, DisplayName = i.Name + " Player (" + i.ItemCount + ")" }); var options = new ListPageConfig { IndexOptions = indexOptions.ToList(), PageTitle = "Games", CustomItemQuery = GetMultiPlayerGames }; SetDefaults(options, null); var page = new FolderPage(item, displayPreferences, ApiClient, _imageManager, PresentationManager, _navService, _playbackManager, _logger, _serverEvents, options) { ViewType = ViewType.Games }; await _navService.Navigate(page); }
public async Task GetPresentation_ShouldReturnPresentation() { // Arrange var queuePresentationAddedMock = new Mock <PresentationAddedQueue>(); var queueScheduleAddedMock = new Mock <PresentationScheduleAddedQueue>(); var presentationRepositoryMock = new Mock <IPresentationRepository>(); presentationRepositoryMock.Setup(presentationRepository => presentationRepository.GetPresentationAsync(It.IsAny <int>())) .ReturnsAsync((int id) => new Presentation { PresentationId = id, Abstract = "Abstract", Title = "Title", PowerpointUri = "PowerpointUri", }); var presentationManager = new PresentationManager(presentationRepositoryMock.Object, queuePresentationAddedMock.Object, queueScheduleAddedMock.Object); var presentationId = 15; // any Random Number will do // Act var presentation = await presentationManager.GetPresentationAsync(presentationId); // Assert Assert.NotNull(presentation); Assert.Equal(presentationId, presentation.PresentationId); Assert.Equal("Abstract", presentation.Abstract); Assert.Equal("Title", presentation.Title); Assert.Equal("PowerpointUri", presentation.PowerpointUri); }
public async Task SavePresentation_WithValidPresentation_ShouldReturnPresentation() { // Arrange var queuePresentationAddedMock = new Mock <PresentationAddedQueue>(); var queueScheduleAddedMock = new Mock <PresentationScheduleAddedQueue>(); var presentationRepositoryMock = new Mock <IPresentationRepository>(); presentationRepositoryMock.Setup(presentationRepository => presentationRepository.SavePresentationAsync(It.IsAny <Presentation>())) .ReturnsAsync((Presentation presentationInput) => presentationInput); var presentationManager = new PresentationManager(presentationRepositoryMock.Object, queuePresentationAddedMock.Object, queueScheduleAddedMock.Object); var presentation = new Presentation { PresentationId = 1, Abstract = "Abstract", Title = "Title", PowerpointUri = "PowerpointUri" }; // Act var savedPresentation = await presentationManager.SavePresentationAsync(presentation); // Assert Assert.NotNull(savedPresentation); Assert.Equal(presentation.PresentationId, savedPresentation.PresentationId); Assert.Equal(presentation.Abstract, savedPresentation.Abstract); Assert.Equal(presentation.Title, savedPresentation.Title); Assert.Equal(presentation.PowerpointUri, savedPresentation.PowerpointUri); }
private async void LoadViewModels() { PresentationManager.ShowLoadingAnimation(); try { var view = await ApiClient.GetFavoritesView(_sessionManager.CurrentUser.Id, CancellationToken.None); LoadSpotlightViewModel(view); LoadMoviesViewModel(view); LoadSeriesViewModel(view); LoadEpisodesViewModel(view); LoadGamesViewModel(view); LoadArtistsViewModel(view); LoadAlbumsViewModel(view); LoadSongsViewModel(view); LoadMiniSpotlightsViewModel(view); LoadMiniSpotlightsViewModel2(view); } catch (Exception ex) { _logger.ErrorException("Error getting home view", ex); PresentationManager.ShowDefaultErrorMessage(); } finally { PresentationManager.HideLoadingAnimation(); } }
private async void LoadViewModels() { var cancellationSource = _mainViewCancellationTokenSource = new CancellationTokenSource(); try { var view = await ApiClient.GetTvView(_sessionManager.LocalUserId, ParentId, cancellationSource.Token); _tvView = view; cancellationSource.Token.ThrowIfCancellationRequested(); LoadSpotlightViewModel(view); LoadAllShowsViewModel(view); LoadMiniSpotlightsViewModel(view); LoadNextUpViewModel(view); LoadLatestEpisodesViewModel(view); LoadResumableViewModel(view); LatestEpisodesViewModel.CurrentItemUpdated += LatestEpisodesViewModel_CurrentItemUpdated; MiniSpotlightsViewModel.CurrentItemUpdated += MiniSpotlightsViewModel_CurrentItemUpdated; NextUpViewModel.CurrentItemUpdated += NextUpViewModel_CurrentItemUpdated; ResumeViewModel.CurrentItemUpdated += ResumeViewModel_CurrentItemUpdated; } catch (Exception ex) { _logger.ErrorException("Error getting tv view", ex); PresentationManager.ShowDefaultErrorMessage(); } finally { DisposeMainViewCancellationTokenSource(false); } }
private void ReloadApps() { _listItems.AddRange(PresentationManager.GetApps(SessionManager.CurrentUser) .Select(i => new AppViewModel(PresentationManager, Logger) { App = i })); }
protected override void Given() { this.chartManager = new ChartManager(); this.powerpointHandle = new Application(); this.presentationManager = new PresentationManager(); this.presentationHandle = this.presentationManager.CreatePowerPointPresentation(this.powerpointHandle, true); this.slideManager = new SlideManager(); this.slideHandle = this.slideManager.AddSlideToEnd(this.presentationHandle); }
/// <summary> /// Finds the parts. /// </summary> protected override void FindParts() { base.FindParts(); ThemeManager.AddParts(GetExports <ITheme>()); PresentationManager.AddParts(GetExports <IAppFactory>(), GetExports <ISettingsPage>(), GetExports <IHomePageInfo>()); PlaybackManager.AddParts(GetExports <IMediaPlayer>()); ScreensaverManager.AddParts(GetExports <IScreensaverFactory>()); }
void Start() { // Define beginning path as the overhead project folder if (defaultPath == null) { defaultPath = "C:/Users/"; } presentationManager = PresentationManager.Instance; }
public App() { // Push the knowledge about connecting and instantiating view and viewmodel to a 3rd party/component. IEventAggregator eventAggregator = new EventAggregator(Current.Dispatcher); IPresentationManager manager = new PresentationManager(); manager.Register<DialogView, DialogViewModel>(); manager.Register<MainView, MainViewModel>(); var mainViewModel = new MainViewModel(manager, eventAggregator); manager.ShowViewFor(mainViewModel); }
// Converts a PDF from a given file path, splits its slides into images, and puts these images into a designated folder public static void ConvertPDF(string pdfPath) { //Get name of the pdf we are converting var pdfName = Path.GetFileNameWithoutExtension(pdfPath); // Create the name of the directory that the images of the PDF will be stored var pdfImagesDirectory = parentFolderPath + "/" + presentationImagePath + "/" + pdfName; // If the folder needed to house the images for this specific presentation doesn't yet exists (meaning, we haven't yet crated the PDF), then convert the PDF if (!AssetDatabase.IsValidFolder(pdfImagesDirectory)) { //Creates a folder to house image assets AssetDatabase.CreateFolder(parentFolderPath + "/" + presentationImagePath, pdfName); // Settings the density to 300 dpi will create an image with a better quality MagickReadSettings settings = new MagickReadSettings(); settings.Density = new Density(350, 350); // Create an image collection when splitting up the PDF using (MagickImageCollection images = new MagickImageCollection()) { // Reads the PDF, and creates images for eah of the pages images.Read(pdfPath, settings); int page = 1; foreach (MagickImage image in images) { // Write page to file that contains the page number var imagePath = pdfImagesDirectory + "/Slide_" + page.ToString("000") + ".jpg"; image.Write(imagePath); // Import the newly created image and convert it to type Texture2D #region KEEPING FOR FUTURE REFERENCE // keeping this if we need it in the future AssetDatabase.ImportAsset(imagePath); TextureImporter importer = AssetImporter.GetAtPath(imagePath) as TextureImporter; importer.textureType = TextureImporterType.Sprite; AssetDatabase.WriteImportSettingsIfDirty(imagePath); // Writing to a specific format works the same as for a single image //image.Format = MagickFormat.Ptif; //image.Write("PDF.Page" + page + ".tif"); #endregion page++; } //refreshes the database to finanlize the import of the PDF images AssetDatabase.Refresh(); } } // Sets the presentation manager pull path to the PDF folder derived from the PDF selected PresentationManager.GetPresentionPath(presentationImagePath + "/" + pdfName); }
public async Task AssignSpeakerToPresentation_writes_to_databaseAsync() { var connection = new SqliteConnection("DataSource=:memory:"); connection.Open(); SpeakerProfile speaker = new SpeakerProfile { SpeakerId = Guid.NewGuid().ToString(), FirstName = "Test First Name", LastName = "Test Last Name", Email = "*****@*****.**", Bio = "My test bio", Company = "Test company", PhotoPath = "Test Path" }; try { var options = new DbContextOptionsBuilder <PlanificatorDbContext>() .UseSqlite(connection) .Options; using (var context = new PlanificatorDbContext(options)) { context.Database.EnsureCreated(); var presentationService = new PresentationManager(context); var speakerServie = new SpeakerManager(context); var testData = new PresentationRepositoryTestsData(); await speakerServie.AddSpeakerProfileAsync(speaker); await presentationService.AddPresentation(testData.presentationTags); await presentationService.AssignSpeakerToPresentationAsync(speaker, testData.presentation); context.SaveChanges(); Assert.Equal(1, context.PresentationSpeakers.Count()); Assert.Equal(speaker, context.PresentationSpeakers.Single().SpeakerProfile); Assert.Equal(testData.presentation, context.PresentationSpeakers.Include(p => p.Presentation).Single().Presentation); } } finally { connection.Close(); } }
public async Task GetScheduledPresentation_ShouldReturnAListScheduledPresentations() { // Arrange var queuePresentationAddedMock = new Mock <PresentationAddedQueue>(); var queueScheduleAddedMock = new Mock <PresentationScheduleAddedQueue>(); var presentationRepositoryMock = new Mock <IPresentationRepository>(); presentationRepositoryMock .Setup(presentationRepository => presentationRepository.GetScheduledPresentationsForPresentationAsync(It.IsAny <int>())) .ReturnsAsync((int presentationIdInput) => new List <ScheduledPresentation> { new ScheduledPresentation { ScheduledPresentationId = 1, AttendeeCount = 1, Presentation = new Presentation { PresentationId = presentationIdInput } }, new ScheduledPresentation { ScheduledPresentationId = 2, AttendeeCount = 1, Presentation = new Presentation { PresentationId = presentationIdInput } } }); var presentationManager = new PresentationManager(presentationRepositoryMock.Object, queuePresentationAddedMock.Object, queueScheduleAddedMock.Object); var presentationId = 15; // Can be any int // Act var scheduledPresentations = await presentationManager.GetScheduledPresentationsForPresentationAsync(presentationId); // Assert Assert.NotNull(scheduledPresentations); var scheduledPresentationsAsList = scheduledPresentations.ToList(); Assert.Equal(2, scheduledPresentationsAsList.Count); for (var i = 0; i < scheduledPresentationsAsList.Count; i++) { var scheduledPresentation = scheduledPresentationsAsList[i]; Assert.NotNull(scheduledPresentation.Presentation); Assert.Equal(presentationId, scheduledPresentation.Presentation.PresentationId); Assert.Equal(i + 1, scheduledPresentation.ScheduledPresentationId); Assert.Equal(1, scheduledPresentation.AttendeeCount); } }
private async void ReloadUsers(bool isInitialLoad) { // Record the current item var currentItem = _listCollectionView.CurrentItem as UserDtoViewModel; var apiClient = SessionManager.ActiveApiClient; try { var users = await apiClient.GetPublicUsersAsync(); int?selectedIndex = null; if (isInitialLoad) { selectedIndex = 0; } else if (currentItem != null) { var index = Array.FindIndex(users, i => string.Equals(i.Id, currentItem.User.Id)); if (index != -1) { selectedIndex = index; } } _listItems.Clear(); _listItems.AddRange(users.Select(i => new UserDtoViewModel(apiClient, ImageManager, SessionManager) { User = i })); if (selectedIndex.HasValue) { ListCollectionView.MoveCurrentToPosition(selectedIndex.Value); } AddCustomEntries(); } catch (Exception) { PresentationManager.ShowDefaultErrorMessage(); } }
public async Task GetAllPresentations_returns_all_presentationsAsync() { var connection = new SqliteConnection("DataSource=:memory:"); connection.Open(); try { var options = new DbContextOptionsBuilder <PlanificatorDbContext>() .UseSqlite(connection) .Options; using (var context = new PlanificatorDbContext(options)) { context.Database.EnsureCreated(); var service = new PresentationManager(context); var query = new PresentationRepository(context); var testData1 = new PresentationRepositoryTestsData(); var testData2 = new PresentationRepositoryTestsData(); var testData3 = new PresentationRepositoryTestsData(); List <Presentation> presentations = new List <Presentation>(); presentations.Add(testData1.presentation); presentations.Add(testData2.presentation); presentations.Add(testData3.presentation); await service.AddPresentation(testData1.presentationTags); await service.AddPresentation(testData2.presentationTags); await service.AddPresentation(testData3.presentationTags); context.SaveChanges(); Assert.Equal(context.Presentations.Count(), query.GetAllPresentations().Count()); Assert.Equal(presentations, query.GetAllPresentations()); } } finally { connection.Close(); } }
private void Setup() { PresentationManager[] managers = FindObjectsOfType <PresentationManager>(); if (managers.Length == 0) { GameObject pm = new GameObject("PresentationManager", typeof(PresentationManager)); pm.transform.SetAsFirstSibling(); presentationManager = pm.GetComponent <PresentationManager>(); Undo.RegisterCreatedObjectUndo(pm, "PresentationManager Setup"); } else if (managers.Length > 1) { EditorUtility.DisplayDialog("Error", "More than 1 \"PresentationManager\" found, please make sure there's only one.", "OK"); } else if (managers.Length == 1) { presentationManager = managers[0]; } if (!FindObjectOfType <CinemachineVirtualCamera>()) { GameObject cm = new GameObject("CM vcam", typeof(CinemachineVirtualCamera)); cm.transform.SetSiblingIndex(1); playableDirector = cm.AddComponent <PlayableDirector>(); playableDirector.playOnAwake = false; Undo.RegisterCreatedObjectUndo(cm, "CM vcam Setup"); } else { playableDirector = FindObjectOfType <CinemachineVirtualCamera>().GetComponent <PlayableDirector>(); } presentationManager.timelineDirector = playableDirector; if (Camera.main && !Camera.main.GetComponent <CinemachineBrain>()) { Camera.main.gameObject.AddComponent <CinemachineBrain>(); } else if (!Camera.main) { EditorUtility.DisplayDialog("Error", "There is no main cammera please create one and press setup again", "OK"); } CreateSlidesFolder(); }