MusicLib
class, add a Reference to the the
MiniPlayerWpf project and to System.Data.DataExtensions
AreEqual(expected, actual)
- Verify two objects are equal using ==
IsTrue(condition)
- Verify a condition is true
IsNull(value)
- Verify value is null
MusicLib.DeleteSong()
method
[TestMethod] public void TestDeleteSong() { MusicLib musicLib = new MusicLib(); // Delete a song that already exists int songId = 8; bool songDeleted = musicLib.DeleteSong(songId); Assert.IsTrue(songDeleted, "Song should have been deleted"); // Verify the song is not in the library anymore Song s = musicLib.GetSong(songId); Assert.IsNull(s, "Returned song should be null because it doesn't exist"); } [TestMethod] public void TestDeleteMissingSong() { MusicLib musicLib = new MusicLib(); // Attempt to delete a song that doesn't exist int songId = 111; bool success = musicLib.DeleteSong(songId); Assert.IsFalse(success, "Non-existing song should not have been deleted"); }
C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x86\inspect.exe
[TestMethod] public void TestUi() { // Launch MiniPlayer app string currentDir = @"C:\path_to_exe_directory\"; string appPath = currentDir + "MiniPlayerWpf.exe"; AppiumOptions options = new AppiumOptions(); options.AddAdditionalCapability("app", appPath); options.AddAdditionalCapability("appWorkingDir", currentDir); var session = new WindowsDriver<WindowsElement>(new Uri("http://127.0.0.1:4723"), options); // Add new song session.FindElementByAccessibilityId("titleTextBox").Clear(); session.FindElementByAccessibilityId("titleTextBox").SendKeys("My Title"); session.FindElementByAccessibilityId("addButton").Click(); // Verify dropdown lists new song ID var songId = session.FindElementByAccessibilityId("songIdComboBox").Text; Assert.AreEqual(songId, "10"); }