Пример #1
0
        public ActionResult Create(Nwd.BackOffice.Model.Album album)
        {
            if (ModelState.IsValid && album.Tracks != null)
            {
                var tracks = album.Tracks;
                AlbumRepository repository = new AlbumRepository();

                repository.CreateAlbum(album, HttpContext.Server);

            }
            return View();
        }
Пример #2
0
        public void Create_Album_With_No_Tracks()
        {
            AlbumRepository repo = new AlbumRepository();
            HttpServerUtilityBase server =  Mock.Of<HttpServerUtilityBase>();

            Album album = repo.CreateAlbum( new BackOffice.Model.Album
            {
                Duration = TimeSpan.FromHours( 2 ),
                Title = RandomName(),
                Artist = new BackOffice.Model.Artist { Name = RandomName() },
                ReleaseDate = DateTime.UtcNow,
                Type = "Pop-Rock"
            }, server );

            Assert.That( album.Id, Is.GreaterThan( 0 ) );
        }
Пример #3
0
        private Album CreateAlbumWithMockFile( AlbumRepository repo, HttpServerUtilityBase server, Mock<HttpPostedFileBase> mock )
        {
            Album album = repo.CreateAlbum( new BackOffice.Model.Album
            {
                Duration = TimeSpan.FromHours( 2 ),
                Title = RandomName(),
                Artist = new BackOffice.Model.Artist { Name = RandomName() },
                ReleaseDate = DateTime.UtcNow,
                Type = "Hip-Hop US",
                Tracks = new List<Track>
                            {
                                new Track
                                {
                                    Number = 1,
                                    Duration = TimeSpan.FromMinutes(4),
                                    File = mock.Object,
                                    Song = new Song
                                    {
                                        Name = RandomName(),
                                        Composed = new DateTime(2010,1,12)
                                    }
                                }
                            }
            }, server );

            return album;
        }