public void TestAppInvalidWhenNoMusicController() { MusicApp app = new MusicApp(); TestInvalidApp(app, "Spotify has encountered some issues with connecting to the service. Please try again later."); Assert.AreEqual(null, app.GetMainGrammar()); }
public ActionResult DeleteConfirmed(int id) { MusicApp musicApp = db.MusicApps.Find(id); db.MusicApps.Remove(musicApp); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Genre,ArtistName,AlbumName,Song,Year,NumberOfSongs")] MusicApp musicApp) { if (ModelState.IsValid) { db.Entry(musicApp).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(musicApp)); }
public ActionResult Create([Bind(Include = "Id,Genre,ArtistName,AlbumName,Song,Year,NumberOfSongs")] MusicApp musicApp) { if (ModelState.IsValid) { db.MusicApps.Add(musicApp); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(musicApp)); }
// GET: MusicApps/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MusicApp musicApp = db.MusicApps.Find(id); if (musicApp == null) { return(HttpNotFound()); } return(View(musicApp)); }
public void TestAppInvalidWhenNoPlaylistsAvailable() { IConfigurationManager configManager = GetConfigurationManager(); Mock <IMusicController> mc = new Mock <IMusicController>(MockBehavior.Strict); AddComponentToConfigurationManager(mc.Object); mc.Setup(s => s.GetPlaylists()).Returns(new List <String>()); MusicApp app = new MusicApp(); TestInvalidApp(app, "Spotify has encountered some issues with connecting to the service. Please try again later."); mc.Verify(s => s.GetPlaylists(), Times.Exactly(2)); }
public void TestStopPlaylist() { Dictionary <String, String> expectedParams = new Dictionary <string, string> { { "Command", "music" }, { "Subcommand", "stop" }, }; SetupMusicController(); IConfigurationManager configManager = GetConfigurationManager(); MusicApp app = new MusicApp(); TestGrammar <MusicApp>("Stop the music", expectedParams); CleanupMusicControllers(1); }
public void TestDeleteSong() { Dictionary <String, String> expectedParams = new Dictionary <string, string> { { "Command", "music" }, { "Subcommand", "deletesong" }, }; SetupMusicController(); IConfigurationManager configManager = GetConfigurationManager(); MusicApp app = new MusicApp(); TestGrammar <MusicApp>("Delete this song", expectedParams); CleanupMusicControllers(1); }
public void TestListPlaylists() { Dictionary <String, String> expectedParams = new Dictionary <string, string> { { "Command", "music" }, { "Subcommand", "playlists" }, }; SetupMusicController(); IConfigurationManager configManager = GetConfigurationManager(); MusicApp app = new MusicApp(); TestGrammar <MusicApp>("What playlists are available", expectedParams); CleanupMusicControllers(1); }
public void TestPlaySomePlaylist() { Dictionary <String, String> expectedParams = new Dictionary <string, string> { { "Command", "music" }, { "Subcommand", "playrandom" }, { "Playlist", "test playlist one" }, }; SetupMusicController(); IConfigurationManager configManager = GetConfigurationManager(); MusicApp app = new MusicApp(); TestGrammar <MusicApp>("Play some test playlist one", expectedParams); CleanupMusicControllers(1); }
public void TestWhoIsPlaying() { Dictionary <String, String> expectedParams = new Dictionary <string, string> { { "Command", "music" }, { "Subcommand", "artist" }, }; SetupMusicController(); IConfigurationManager configManager = GetConfigurationManager(); MusicApp app = new MusicApp(); TestGrammar <MusicApp>("Who is playing", expectedParams); TestGrammar <MusicApp>("Who is this", expectedParams); CleanupMusicControllers(2); }
public MusicController(MusicApp musicApp, IWebHostEnvironment hostingEnvironment, IOptions <AppSetting> appConfiguration) { environment = hostingEnvironment; MusicApp = musicApp; AppConfiguration = appConfiguration; }