public void UpdatePlaylistEntityNotExist() { Playlist newPlaylist = new Playlist() { Id = 1, Name = "", Description = "Old hits", PlaylistCategory = new List <PlaylistCategory>(), PlaylistTrack = new List <PlaylistTrack>() }; PlaylistCategory play = new PlaylistCategory { IdCategory = 100, }; playlistList[0].PlaylistCategory.Add(play); newPlaylist.PlaylistCategory.Add(play); var mockPlaylist = new Mock <IPlaylistLogic>(MockBehavior.Strict); mockPlaylist.Setup(l => l.Get(playlistList[0].Id)).Returns(playlistList[0]); mockPlaylist.Setup(l => l.Update(playlistList[0], 1)).Throws(new EntityNotExists("One ore more category do not exist")); var controller = new PlaylistController(mockPlaylist.Object); var result = controller.UpdatePlaylist(1, newPlaylist); Mock.VerifyAll(); Assert.AreEqual(new NotFoundObjectResult("").ToString(), result.ToString()); }
public void UpdatePlaylistEntityAlreadyExist() { Playlist newPlaylist = new Playlist() { Id = 1, Name = "", Description = "Old hits", PlaylistCategory = new List <PlaylistCategory>(), PlaylistTrack = new List <PlaylistTrack>() }; PlaylistCategory play = new PlaylistCategory { IdCategory = 1, }; PlaylistCategory play2 = new PlaylistCategory { IdCategory = 1, }; playlistList[0].PlaylistCategory.Add(play); newPlaylist.PlaylistCategory.Add(play); newPlaylist.PlaylistCategory.Add(play2); var mockPlaylist = new Mock <IPlaylistLogic>(MockBehavior.Strict); mockPlaylist.Setup(l => l.Get(playlistList[0].Id)).Returns(playlistList[0]); mockPlaylist.Setup(l => l.Update(playlistList[0], 1)).Throws(new EntityAlreadyExist("There are two or more equal categories")); var controller = new PlaylistController(mockPlaylist.Object); var result = controller.UpdatePlaylist(1, newPlaylist); Mock.VerifyAll(); Assert.AreEqual(new UnprocessableEntityObjectResult("").ToString(), result.ToString()); }
protected override void OnInitialize() { base.OnInitialize(); musicFileContext = Container.GetExportedValue <MockMusicFileContext>(); musicFiles = new ObservableCollection <MusicFile>() { musicFileContext.Create(@"C:\Users\Public\Music\Dancefloor\Culture Beat - Serenity.wav"), musicFileContext.Create(@"C:\Culture Beat - Serenity - Epilog.wma"), }; selectionService = Container.GetExportedValue <SelectionService>(); selectionService.Initialize(musicFiles); playlistManager = new PlaylistManager(); controller = Container.GetExportedValue <PlaylistController>(); controller.PlaylistSettings = new PlaylistSettings(); controller.PlaylistManager = playlistManager; controller.Initialize(); controller.Run(); shellService = Container.GetExportedValue <ShellService>(); var view = shellService.PlaylistView; viewModel = ViewHelper.GetViewModel <PlaylistViewModel>((IView)view); }
public void PutPlaylist() { string playlistId = "e643958a-f388-4c0c-ab90-787336a61ae1"; string musicaId = "283e6fc6-121c-4f84-bce8-29b94b734456"; var controller = new PlaylistController(_playlistsContext, _usersContext, _playlistMusicasContext, _musicasContext); var playlistMusicaExist = controller.PlaylistMusicaExistsByPlaylistIdMusicaId(playlistId, musicaId); if (playlistMusicaExist != null && playlistMusicaExist.Result != null) { _playlistMusicasContext.PlaylistMusicas.Remove(playlistMusicaExist.Result); _playlistMusicasContext.SaveChanges(); } Musicas musica = new Musicas { Id = musicaId }; var resultPlaylist = controller.PutPlaylist(playlistId, musica); Assert.IsType <OkResult>(resultPlaylist.Result); }
void OnSongChanged(string newSongName) { var simpleSongController = PlaylistController.InstanceByName("PC Simple Music"); simpleSongController.TriggerPlaylistClip(newSongName.Replace("multiver", "nomultiver")); simpleSongController.ActiveAudioSource.timeSamples = mainPlaylistController.ActiveAudioSource.timeSamples; }
void Awake() { GameControl.instance = this; Paused = false; GameStarted = false; ClearAnimationOngoing = false; GameOver = false; musicOn = true; processNextMove = true; InitializeCamera(); lastShift = new IntVector2(0, 0); comboTextQueue = new Queue <ComboText>(); foreach (var comboText in FindObjectsOfType(typeof(ComboText))) { comboTextQueue.Enqueue((ComboText)comboText); } simpleSongController = PlaylistController.InstanceByName("PC Simple Music"); enhancedSongController = PlaylistController.InstanceByName("PC Enhanced Music"); if (GlobalData.Instance.FriendsScores == null) { GlobalData.Instance.OnFriendsScoresSet += ShowSuperiorPlayer; } if (GlobalData.Instance.GlobalTopScores == null) { GlobalData.Instance.OnGlobalTopScoresSet += ShowSuperiorPlayer; } }
public override IEnumerator StartGame(float delay) { var animLength = 0.5f; //Animate bonus bar iTween.ColorFrom(bonusBar.gameObject, iTween.Hash("a", 0, "time", 1, "delay", 0, "easetype", "easeInOutBack")); iTween.MoveFrom(bonusBar.gameObject, iTween.Hash("z", -5f, "time", 1, "delay", 0, "easetype", "easeInOutBack")); var child = bonusBar.GetComponentInChildren <tk2dSprite>(); iTween.ColorTo(child.gameObject, iTween.Hash("a", 1, "time", animLength, "delay", delay - animLength, "easetype", "easeOutCubic")); //Animate level progress indicator //iTween.ColorFrom(levelProgressIndicator.gameObject, iTween.Hash("a", 0, "time", 1, "delay", 0, "easetype", "easeInOutBack")); //iTween.MoveFrom(levelProgressIndicator.gameObject, iTween.Hash("z", -5f, "time", 1, "delay", 0, "easetype", "easeInOutBack")); //levelTitleText.PlayAnimation(); //levelText.PlayAnimation(); yield return(new WaitForSeconds(delay)); var piece = GameControl.Instantiate(GameController.piecePrefab, GameController.SlotGrid[4, 4].transform.position, Quaternion.identity) as Piece; piece.name = GameController.piecePrefab.name; GameController.CurrentPiece = piece; var nextPieceInfo = GetNextPiece(); GameController.CurrentPiece.InitPiece(nextPieceInfo.Layout, nextPieceInfo.Variant); complicationPreview.StartCrossFade = true; GameController.GameStarted = true; PlaylistController.InstanceByName("PC Enhanced Music").PlayRandomSong(); }
public async void CheckingForViewWhenFirstTimeDefaultPlaylistUser() { DbContextOptions <MusicDbContext> options = new DbContextOptionsBuilder <MusicDbContext>() .UseInMemoryDatabase("DisplayPlaylistTwo").Options; using (MusicDbContext context = new MusicDbContext(options)) { User user = new User(); user.Name = "username"; Playlist playlist = new Playlist(); playlist.Id = 27; await context.Users.AddAsync(user); await context.Playlists.AddAsync(playlist); await context.SaveChangesAsync(); user.GenreID = 3; context.Users.Update(user); context.Playlists.Update(playlist); await context.SaveChangesAsync(); PlaylistViewModel plvm = new PlaylistViewModel(); plvm.User = user; PlaylistController plc = new PlaylistController(context); var result = await plc.Get(user.Id) as ViewResult; var plVMTest = (PlaylistViewModel)result.ViewData.Model; var testingResult = plVMTest.User.Id; Assert.Equal(user.Id, testingResult); } }
public async void CheckToSeeIfPlaylistDeletes() { DbContextOptions <MusicDbContext> options = new DbContextOptionsBuilder <MusicDbContext>() .UseInMemoryDatabase("DeletePlaylist").Options; using (MusicDbContext context = new MusicDbContext(options)) { User user4 = new User(); user4.Name = "username"; Playlist playlist = new Playlist(); playlist.Id = 27; user4.PlaylistID = playlist.Id.Value; playlist.UserID = user4.Id; user4.GenreID = 3; await context.Users.AddAsync(user4); await context.Playlists.AddAsync(playlist); await context.SaveChangesAsync(); PlaylistController plc = new PlaylistController(context); var result = await plc.Delete(user4.Id); var redirectToActionResult = Assert.IsType <RedirectToActionResult>(result); Assert.Equal("Edit", redirectToActionResult.ActionName); } }
public void TestMethod1() { PlaylistController controller = new PlaylistController(); ViewResult addsong = controller.AddSong(5, 1) as ViewResult; Assert.IsNotNull(addsong); }
static int Main(string[] args) { if (args.Length <= 0) { Console.WriteLine("Please enter the file name as the parameter. (File path together)" + Environment.NewLine + "Ex: PlaylistStatistics.exe \"C:\\document.csv\""); Console.ReadKey(); return(Environment.ExitCode); } ConsoleHeader(); string outputPath = Path.GetDirectoryName(args[0]); DateTime processDate = new DateTime(2016, 08, 10); // In the .csv file provided to us, the data is divided by tab space(\t). PlaylistController playlistController = new PlaylistController(args[0], '\t'); var clientPlaylistHistories = playlistController.ClientPlaylistHistories(processDate); playlistController.WriteFileClientPlaylistHistories(clientPlaylistHistories, "CLIENT_ID\tDISTINCT_PLAY_COUNT", outputPath, "ClientPlaylistHistories.txt"); var playlistStatistics = playlistController.PlaylistStatistics(processDate); playlistController.WriteFilePlaylistStatistics(playlistStatistics, "DISTINCT_PLAY_COUNT\tCLIENT_COUNT", outputPath, "PlaylistStatistics.txt"); Console.WriteLine("Çıkmak için enter'a basınız.."); Console.ReadKey(); return(0); }
public void GetPlaylist_Login_Invalido() { string filtro = "bla"; var controller = new PlaylistController(_playlistsContext, _usersContext, _playlistMusicasContext, _musicasContext); var resulPlaylist = controller.GetPlaylist(filtro); Assert.IsType <NotFoundResult>(resulPlaylist); }
public void GetPlaylist_Login_Valido() { string filtro = "ana"; var controller = new PlaylistController(_playlistsContext, _usersContext, _playlistMusicasContext, _musicasContext); var resultPlaylist = controller.GetPlaylist(filtro); Assert.IsType <OkObjectResult>(resultPlaylist); }
public void TearDown() { controller.Stop(); controller = null; storageMock.ResetCalls(); storageManagerMock.ResetCalls(); mockGuiToolkit.ResetCalls(); }
public void PutPlaylist_Identificador_PlaylistId_Invalido() { string playlistId = "teste"; var controller = new PlaylistController(_playlistsContext, _usersContext, _playlistMusicasContext, _musicasContext); var resultPlaylist = controller.PutPlaylist(playlistId, null); Assert.IsType <BadRequestResult>(resultPlaylist.Result); }
// Use this for initialization void Start() { if (mainPlaylistController == null) { mainPlaylistController = GetComponent <PlaylistController>(); } mainPlaylistController.SongChanged += OnSongChanged; }
public override void OnExport(string fileName, LibraryItem item) { if (string.IsNullOrEmpty(fileName) || item == null || item.Type != LibraryType.Playlist) { return; } PlaylistController.Save(fileName, item as PlaylistInfo); }
public PlaylistViewModel(Playlist playlist) { PlaylistController = new PlaylistController(playlist); PlayListTracksOC = new ObservableCollection <Track>(); LoadElements(); LoadPlaylistInfo(); InitializeCommands(); }
public void GetAllPlaylists() { var mockPlaylist = new Mock <IPlaylistLogic>(MockBehavior.Strict); mockPlaylist.Setup(u => u.GetAll()).Returns(playlistList); var playlistController = new PlaylistController(mockPlaylist.Object); Assert.AreEqual(new OkObjectResult("").ToString(), playlistController.GetAll().ToString()); }
public new void TestFixtureSetUp() { PlaylistController = new PlaylistController(Logger, Session, ManagerFactory); PlaylistItemController = new PlaylistItemController(Logger, Session, ManagerFactory); ShareCodeManager = ManagerFactory.GetShareCodeManager(Session); UserManager = ManagerFactory.GetUserManager(Session); PlaylistManager = ManagerFactory.GetPlaylistManager(Session); }
void SetupWithStorage() { controller = new PlaylistController(); playlistCollectionVM = new PlaylistCollectionVM(); controller.SetViewModel(new DummyPlaylistsManagerVM { Playlists = playlistCollectionVM, Player = videoPlayerVM }); controller.Start(); }
public void AddTrack_TrackALreadyExists_ReturnsException() { //Arrange Track track = new Track(); PlaylistController playlistController = new PlaylistController("Playlist"); //Act / Assert playlistController.AddTrack(track); //Add track to playlist playlistController.AddTrack(track); //Add track to playlist second time -> returns exception }
// Use this for initialization void Awake() { playlistController = FindObjectOfType <PlaylistController>(); maskBannerRect = GetComponent <RectTransform>(); songRect = transform.GetChild(0).GetComponent <RectTransform>(); songText = transform.GetChild(0).GetComponent <Text>(); playlistController.SongChanged += SongChangedVoid; }
public void AddPlaylistError() { playlistList[0].Name = ""; var mockPlaylist = new Mock <IPlaylistLogic>(MockBehavior.Strict); mockPlaylist.Setup(r => r.Add(playlistList[0])).Throws(new FieldEnteredNotCorrect("")); PlaylistController controller = new PlaylistController(mockPlaylist.Object); var result = controller.Add(playlistList[0]); Assert.AreEqual(new UnprocessableEntityObjectResult("").ToString(), result.ToString()); }
public void ConnectPlaylist(Playlist playlist, User user) { // Adds the playlist to the playback and starts the playback (if it isn't already started) // Note that adding one playlist multiple times is allowed and should not cause any issues PlaylistController.AddPlaylist(playlist, user); if (CurrentTrack == null) { StartNextSong(); } }
public void DeletePlaylistIdNegative() { var mockPlaylist = new Mock <IPlaylistLogic>(MockBehavior.Strict); var controller = new PlaylistController(mockPlaylist.Object); controller.Add(playlistList[0]); var result = controller.DeletePlaylist(-2); Assert.AreEqual(new NotFoundObjectResult("").ToString(), result.ToString()); }
public void GetOnePlaylistError() { var mockPlaylist = new Mock <IPlaylistLogic>(MockBehavior.Strict); mockPlaylist.Setup(res => res.Get(playlistList[0].Id)).Throws(new Exception()); PlaylistController controller = new PlaylistController(mockPlaylist.Object); var result = controller.Get(playlistList[0].Id); mockPlaylist.VerifyAll(); Assert.AreEqual(result.ToString(), new ObjectResult("").ToString()); }
public void PutPlaylist_Identificador_MusicaId_Invalido() { string playlistId = "e643958a-f388-4c0c-ab90-787336a61ae1"; Musicas musica = new Musicas { Id = "teste_errado" }; var controller = new PlaylistController(_playlistsContext, _usersContext, _playlistMusicasContext, _musicasContext); var resultPlaylist = controller.PutPlaylist(playlistId, musica); Assert.IsType <BadRequestResult>(resultPlaylist.Result); }
public void DeletePlaylistNotExists() { var mockPlaylist = new Mock <IPlaylistLogic>(MockBehavior.Strict); mockPlaylist.Setup(l => l.Get(1)).Returns(playlistList[0]); var controller = new PlaylistController(mockPlaylist.Object); var result = controller.DeletePlaylist(3); Assert.AreEqual(new ObjectResult("").ToString(), result.ToString()); }
public void AddOnePlaylist() { var mockPlaylist = new Mock <IPlaylistLogic>(MockBehavior.Strict); mockPlaylist.Setup(res => res.Get(playlistList[0].Id)).Returns(playlistList[0]); PlaylistController controller = new PlaylistController(mockPlaylist.Object); var result = controller.Add(playlistList[0]); var okResult = result as OkObjectResult; Assert.AreEqual(new ObjectResult("").ToString(), controller.Add(playlistList[0]).ToString()); }
public static IEnumerator PopulateResourceSongToPlaylistControllerAsync(string songResourceName, string playlistName, PlaylistController controller) { Debug.LogError("If this method got called, please report it to Dark Tonic immediately. It should not happen."); yield break; }
public static IEnumerator PopulateResourceSongToPlaylistControllerAsync(string songResourceName, string playlistName, PlaylistController controller) { var asyncRes = Resources.LoadAsync(songResourceName, typeof(AudioClip)); while (!asyncRes.isDone) { yield return MasterAudio.endOfFrameDelay; } var resAudioClip = asyncRes.asset as AudioClip; if (resAudioClip == null) { MasterAudio.LogWarning("Resource file '" + songResourceName + "' could not be located from Playlist '" + playlistName + "'."); yield break; } FinishRecordingPlaylistClip(controller.ControllerName, resAudioClip); controller.FinishLoadingNewSong(resAudioClip); }
void Awake() { instance = this; audioSource = gameObject.GetComponent<AudioSource>(); }
public static DTFunctionButtons AddPlaylistControllerSetupButtons(PlaylistController controller, string itemName, MasterAudio sounds, bool jukeboxMode) { var deleteIcon = sounds.deleteTexture; var settingsIcon = sounds.settingsTexture; var muteContent = new GUIContent(sounds.muteOffTexture, "Click to mute " + itemName); if (controller.isMuted) { muteContent.image = sounds.muteOnTexture; } var mutePressed = GUILayout.Button(muteContent, EditorStyles.toolbarButton); if (!jukeboxMode) { // Remove Button - Process presses later bool goPressed = GUILayout.Button(new GUIContent(settingsIcon, "Click to edit " + itemName), EditorStyles.toolbarButton); bool removePressed = false; if (Application.isPlaying) { //GUILayout.Space(26); } else { removePressed = GUILayout.Button(new GUIContent(deleteIcon, "Click to delete " + itemName), EditorStyles.toolbarButton); } if (removePressed) { return DTFunctionButtons.Remove; } if (goPressed) { return DTFunctionButtons.Go; } } // Return the pressed button if any if (mutePressed) { return DTFunctionButtons.Mute; } return DTFunctionButtons.None; }
public static DTFunctionButtons AddPlaylistControllerGOButtons(PlaylistController controller, string itemName) { var muteContent = new GUIContent(MasterAudioInspectorResources.MuteOffTexture, "Click to mute " + itemName); if (controller.isMuted) { muteContent.image = MasterAudioInspectorResources.MuteOnTexture; } var mutePressed = GUILayout.Button(muteContent, EditorStyles.toolbarButton, GUILayout.Width(32)); // Return the pressed button if any if (mutePressed) { return DTFunctionButtons.Mute; } return DTFunctionButtons.None; }
void Start() { controller = PlaylistController.InstanceByName(playlistControllerName); controller.SongEnded += SongEnded; }