Beispiel #1
0
        public void Should_ReturnMinusOne_When_CalledCheckSongExistsInDatabase_SongDoesntExistInDatabase()
        {
            //Arrange
            SongService songService = new SongService();
            int         lastId      = songService.GetLastId();
            Song        song1       = new Song(lastId + 1, "The Weeknd", "The Hills", GenreName.Pop, 2015, 1, "");
            Song        song2       = new Song(lastId + 2, "Selah Sue", "Crazy Vibes", GenreName.Jazz, 2011, 1, "");

            songService.AddItem(song2);

            //Act
            var result = songService.CheckSongExistsInDatabase(song1.Title);

            //Assert
            result.Should().NotBe(null);
            result.Should().BeOfType(typeof(int));
            result.Should().Be(-1);
        }
Beispiel #2
0
        public void Should_SongId_When_CheckSongExistsInDatabase()
        {
            //Arrange
            SongService songService = new SongService();
            int         lastId      = songService.GetLastId();
            Song        song        = new Song(lastId + 1, "The Weeknd", "The Hills", GenreName.Pop, 2015, 1, "");

            songService.AddItem(song);
            //Act
            var result2 = songService.CheckSongExistsInDatabase(song.Title);

            //Assert
            result2.Should().NotBe(null);
            result2.Should().BeOfType(typeof(int));
            result2.Should().Be(song.Id);
            //Clear
            songService.RemoveItem(song);
        }