public void GetSongsListFromAlbumTest()
        {
            //Arrange
            var song1 = new MusicStore.DataAccess.Song()
            {
                Id    = 0,
                Name  = "All world for you",
                Price = 1.99m,
            };
            var album = new MusicStore.DataAccess.Album()
            {
                Id   = 1,
                Name = "Album 1",
                DiscountIfBuyAllSongs = 15.0m,
            };

            album.Songs.Add(song1);
            var albumDomain = new MusicStore.Domain.DataTransfer.Album()
            {
                Id   = 1,
                Name = "Album 1",
                DiscountIfBuyAllSongs = 15.0m,
            };

            mockUnitOfWork.Setup(x => x.AlbumRepositoryWithPagination).Returns(mockAlbumRepository.Object);
            var albumList = new List <MusicStore.DataAccess.Album>()
            {
                album
            };
            var songDomain = new MusicStore.Domain.DataTransfer.Song()
            {
                Id    = 0,
                Name  = "All world for you",
                Price = 1.99m,
            };
            var songDomainList = new List <MusicStore.Domain.DataTransfer.Song>()
            {
                songDomain
            };

            albumDomain.Songs = new List <MusicStore.DataAccess.Song>();
            albumDomain.Songs.Add(song1);
            mockAlbumRepository.Setup(x => x.GetItem(DEFAULT_ENTITIES_ID)).Returns(album);
            mockMapAlbum.Setup(x => x.AutoMap(It.IsAny <MusicStore.DataAccess.Album>())).Returns(albumDomain);
            mockMapSong.Setup(x => x.AutoMap(It.IsAny <MusicStore.DataAccess.Song>())).Returns(songDomain);
            var musicStoreDisplayService = new MusicStoreDisplayService(mockUnitOfWork.Object, mockMapSong.Object, mockMapAlbum.Object);

            //Act
            var result = musicStoreDisplayService.GetSongsListFromAlbum(DEFAULT_ENTITIES_ID);

            //Assert
            Assert.Equal(songDomainList, result);
        }
        public void DisplayAllAvailableSongsTest()
        {
            //Arrange
            mockUnitOfWork.Setup(x => x.SongRepository).Returns(mockSongRepository.Object);
            mockUnitOfWork.Setup(x => x.UserAccountRepository).Returns(mockUserRepository.Object);
            mockUnitOfWork.Setup(x => x.BoughtSongRepository).Returns(mockBoughtSongRepository.Object);
            mockUnitOfWork.Setup(x => x.SongStoreRepository).Returns(mockSongStoreRepository.Object);

            var song = new MusicStore.DataAccess.Song()
            {
                Id    = 0,
                Name  = "All world for you",
                Price = 1.99m,
            };
            var songDomain = new MusicStore.Domain.DataTransfer.Song()
            {
                Id    = 0,
                Name  = "All world for you",
                Price = 1.99m,
            };
            List <MusicStore.DataAccess.Song> songs = new List <MusicStore.DataAccess.Song>
            {
                song
            };
            List <MusicStore.Domain.DataTransfer.Song> songsDomain = new List <MusicStore.Domain.DataTransfer.Song>
            {
                songDomain
            };

            mockMapSong.Setup(x => x.AutoMap(It.IsAny <MusicStore.DataAccess.Song>())).Returns(songDomain);
            mockSongStoreRepository.Setup(x => x.GetSongsAvailableToBuyByUser(DEFAULT_ENTITIES_ID)).Returns(songs);

            var musicStoreDisplayService = new MusicStoreDisplayService(mockUnitOfWork.Object, mockMapSong.Object, mockMapAlbum.Object);


            //Act
            var result = musicStoreDisplayService.DisplayAllAvailableSongs(DEFAULT_ENTITIES_ID);

            //Assert
            Assert.Equal(songsDomain, result);
        }
        public void GetSongsListFromAlbumAvailableForBuyByUserTestByNotOverLappingValues()
        {
            //Arrange
            User user = new User()
            {
                Id        = DEFAULT_ENTITIES_ID,
                FirstName = "1",
                LastName  = "2",
                Money     = 12
            };
            var album = new MusicStore.DataAccess.Album()
            {
                Id   = 1,
                Name = "Album 1",
                DiscountIfBuyAllSongs = 15.0m,
            };
            var song1 = new MusicStore.DataAccess.Song()
            {
                Id    = 1,
                Name  = "All world for you",
                Price = 1.99m,
                Album = album,
            };
            var song2 = new MusicStore.DataAccess.Song()
            {
                Id    = 2,
                Name  = "All world again you",
                Price = 2.99m,
                Album = album
            };
            var song3 = new MusicStore.DataAccess.Song()
            {
                Id    = 3,
                Name  = "All world do not see you",
                Price = 3.99m,
                Album = album
            };
            var song4 = new MusicStore.DataAccess.Song()
            {
                Id    = 4,
                Name  = "4",
                Price = 4.99m,
            };
            var song5 = new MusicStore.DataAccess.Song()
            {
                Id    = 5,
                Name  = "5",
                Price = 4.99m,
            };
            var boughtSong1 = new MusicStore.DataAccess.BoughtSong()
            {
                Id          = 0,
                User        = user,
                IsVisible   = true,
                Song        = song4,
                BoughtPrice = song4.Price,
                BoughtDate  = new DateTime(2018, 10, 3)
            };
            var boughtSong2 = new MusicStore.DataAccess.BoughtSong()
            {
                Id          = 1,
                User        = user,
                IsVisible   = true,
                Song        = song5,
                BoughtPrice = song5.Price,
                BoughtDate  = new DateTime(2018, 10, 3)
            };

            album.Songs.Add(song1);
            album.Songs.Add(song2);
            album.Songs.Add(song3);
            user.BoughtSongs.Add(boughtSong1);
            user.BoughtSongs.Add(boughtSong2);

            var albumDomain = new MusicStore.Domain.DataTransfer.Album()
            {
                Id   = 1,
                Name = "Album 1",
                DiscountIfBuyAllSongs = 15.0m,
            };

            var albumList = new List <MusicStore.DataAccess.Album>()
            {
                album
            };
            var songDomain = new MusicStore.Domain.DataTransfer.Song()
            {
                Id    = 0,
                Name  = "All world for you",
                Price = 1.99m,
            };
            var songDomainList = new List <MusicStore.Domain.DataTransfer.Song>();

            songDomainList.Add(songDomain);
            songDomainList.Add(songDomain);
            songDomainList.Add(songDomain);
            albumDomain.Songs = new List <MusicStore.DataAccess.Song>();
            albumDomain.Songs.Add(song1);


            mockUnitOfWork.Setup(x => x.AlbumRepositoryWithPagination).Returns(mockAlbumRepository.Object);
            mockUnitOfWork.Setup(X =>
                                 X.UserAccountRepository).Returns(mockUserRepository.Object);


            mockAlbumRepository.Setup(x => x.GetItem(DEFAULT_ENTITIES_ID)).Returns(album);
            mockUserRepository.Setup(X => X.GetItem(DEFAULT_ENTITIES_ID)).Returns(user);

            mockMapAlbum.Setup(x => x.AutoMap(It.IsAny <MusicStore.DataAccess.Album>())).Returns(albumDomain);
            mockMapSong.Setup(x => x.AutoMap(It.IsAny <MusicStore.DataAccess.Song>())).Returns(songDomain);
            var musicStoreDisplayService = new MusicStoreDisplayService(mockUnitOfWork.Object, mockMapSong.Object, mockMapAlbum.Object);

            //Act
            var result = musicStoreDisplayService.GetSongsListFromAlbumAvailableForBuyByUser(DEFAULT_ENTITIES_ID, DEFAULT_ENTITIES_ID);

            //Assert
            Assert.Equal(songDomainList, result);
        }