Пример #1
0
        public TrackLogicTest()
        {
            var repoMocked = new TrackRepositoryMocked();

            _unitOfWork = repoMocked.GetInstance();
            _trackLogic = new TrackLogic(_unitOfWork);
        }
Пример #2
0
 public TTrackController(TelemetryScopedLogger logger, IMapper mapper, ITenantRepository tenantRepository, TrackLogic trackLogic) : base(logger)
 {
     this.logger           = logger;
     this.mapper           = mapper;
     this.tenantRepository = tenantRepository;
     this.trackLogic       = trackLogic;
 }
        public void Initialize()
        {
            category = new Category()
            {
                Id   = 1,
                Name = "Dormir"
            };
            secondCategory = new Category()
            {
                Id   = 2,
                Name = "Musica"
            };
            categoryList = new List <Category>();
            categoryList.Add(category);
            categoryList.Add(secondCategory);
            playlist = new Playlist()
            {
                Id               = 0,
                Name             = "Reggaeton",
                Description      = "Old hits, daddy yankee",
                PlaylistCategory = new List <PlaylistCategory>()
                {
                    new PlaylistCategory
                    {
                        Category   = category,
                        IdCategory = category.Id
                    }
                },
                PlaylistTrack = new List <PlaylistTrack>(),
                PlaylistVideo = new List <PlaylistVideo>()
            };
            playlistList.Add(playlist);
            repositoryPlaylist = new Mock <IData <Playlist> >();
            repositoryCategory = new Mock <IData <Category> >();
            repositoryTrack    = new Mock <IData <Track> >();
            repositoryVideo    = new Mock <IData <Video> >();

            repositoryPlaylist.Setup(r => r.GetAll()).Returns(playlistList);
            repositoryCategory.Setup(r => r.GetAll()).Returns(categoryList);
            repositoryTrack.Setup(r => r.GetAll()).Returns(trackList);

            repositoryPlaylist.Setup(play => play.Get(0)).Returns(playlist);
            repositoryPlaylist.Setup(play => play.Add(playlist));
            trackLogic    = new TrackLogic(repositoryTrack.Object, repositoryCategory.Object, repositoryPlaylist.Object);
            videoLogic    = new VideoLogic(repositoryVideo.Object, repositoryCategory.Object, repositoryPlaylist.Object);
            playlistLogic = new PlaylistLogic(repositoryPlaylist.Object, repositoryCategory.Object, trackLogic, videoLogic, repositoryTrack.Object, repositoryVideo.Object);
        }
        public void Initialize()
        {
            category = new Category()
            {
                Id   = 1,
                Name = "Dormir"
            };
            secondCategory = new Category()
            {
                Id   = 2,
                Name = "Musica"
            };
            categoryList = new List <Category>();
            categoryList.Add(category);
            categoryList.Add(secondCategory);
            track = new Track()
            {
                Id            = 0,
                Name          = "Gasolina",
                Author        = "Daddy yankee",
                Sound         = "www.youtube.com/daddyyanke/gasolina.mp3",
                Hour          = 0,
                MinSeconds    = 2.50,
                CategoryTrack = new List <CategoryTrack>(),
                PlaylistTrack = new List <PlaylistTrack>()
            };
            CategoryTrack categoryTrack = new CategoryTrack
            {
                IdCategory = 1
            };

            track.CategoryTrack.Add(categoryTrack);
            trackList.Add(track);
            repositoryTrack    = new Mock <IData <Track> >();
            repositoryCategory = new Mock <IData <Category> >();
            repositoryPlaylist = new Mock <IData <Playlist> >();

            repositoryTrack.Setup(r => r.GetAll()).Returns(trackList);
            repositoryCategory.Setup(r => r.GetAll()).Returns(categoryList);
            repositoryPlaylist.Setup(r => r.GetAll()).Returns(playlistList);

            repositoryTrack.Setup(play => play.Get(0)).Returns(track);
            trackLogic = new TrackLogic(repositoryTrack.Object, repositoryCategory.Object, repositoryPlaylist.Object);
        }