public ActionResult Show(int artistId, int compactDiskId)
        {
            CompactDisk compactDisk           = CompactDisk.Find(compactDiskId);
            Dictionary <string, object> model = new Dictionary <string, object>();
            Artist artist = Artist.Find(artistId);

            model.Add("compactdisk", compactDisk);
            model.Add("artist", artist);
            return(View(model));
        }
        public void GetTitle_ReturnsTitle_String()
        {
            //Arrange
            string      title          = "disktitle";
            CompactDisk newCompactDisk = new CompactDisk(title);

            //Act
            string result = newCompactDisk.GetTitle();

            //Assert
            Assert.AreEqual(title, result);
        }
        public void GetId_CompactDisksInstantiateWithAnIdAndGetterReturns_Int()
        {
            //Arrange
            string      title1         = "myfirsttitle";
            CompactDisk newCompactDisk = new CompactDisk(title1);

            //Act
            int result = newCompactDisk.GetId();

            //Assert
            Assert.AreEqual(1, result);
        }
        public void GetAll_ReturnsEmptyList_CompactDiskList()
        {
            // Arrange
            List <CompactDisk> newList = new List <CompactDisk> {
            };

            // Act
            List <CompactDisk> result = CompactDisk.GetAll();

            // Assert
            CollectionAssert.AreEqual(newList, result);
        }
Exemple #5
0
        public ActionResult Create(int artistId, string compactDiskTitle)
        {
            Dictionary <string, object> model = new Dictionary <string, object>();
            Artist      foundArtist           = Artist.Find(artistId);
            CompactDisk newCompactDisk        = new CompactDisk(compactDiskTitle);

            foundArtist.AddCompactDisk(newCompactDisk);
            List <CompactDisk> artistCompactDisks = foundArtist.GetCompactDisks();

            model.Add("compactDisks", artistCompactDisks);
            model.Add("artist", foundArtist);
            return(View("Show", model));
        }
        public void Find_ReturnsCorrectCompactDisk_CompactDisk()
        {
            //Arrange
            string      title1          = "myfirsttitle";
            string      title2          = "mysecondtitle";
            CompactDisk newCompactDisk1 = new CompactDisk(title1);
            CompactDisk newCompactDisk2 = new CompactDisk(title2);

            //Act
            CompactDisk result = CompactDisk.Find(2);

            //Assert
            Assert.AreEqual(newCompactDisk2, result);
        }
        public void SetTitle_SetTitle_String()
        {
            //Arrange
            string      title          = "disktitle";
            CompactDisk newCompactDisk = new CompactDisk(title);

            //Act
            string updatedTitle = "newtitle";

            newCompactDisk.SetTitle(updatedTitle);
            string result = newCompactDisk.GetTitle();

            //Assert
            Assert.AreEqual(updatedTitle, result);
        }
        public void GetAll_ReturnsCompactDisks_CompactDiskList()
        {
            //Arrange
            string             title1          = "myfirsttitle";
            string             title2          = "mysecondtitle";
            CompactDisk        newCompactDisk1 = new CompactDisk(title1);
            CompactDisk        newCompactDisk2 = new CompactDisk(title2);
            List <CompactDisk> newList         = new List <CompactDisk> {
                newCompactDisk1, newCompactDisk2
            };

            //Act
            List <CompactDisk> result = CompactDisk.GetAll();

            //Assert
            CollectionAssert.AreEqual(newList, result);
        }
Exemple #9
0
        public void AddCompactDisk_AssociatesCompactDiskWithArtist_CompactDiskList()
        {
            //Arrange
            string             title          = "testtitle";
            CompactDisk        newCompactDisk = new CompactDisk(title);
            List <CompactDisk> newList        = new List <CompactDisk> {
                newCompactDisk
            };
            string name      = "Prince";
            Artist newArtist = new Artist(name);

            newArtist.AddCompactDisk(newCompactDisk);

            //Act
            List <CompactDisk> result = newArtist.GetCompactDisks();

            //Assert
            CollectionAssert.AreEqual(newList, result);
        }
 public ActionResult DeleteAll()
 {
     CompactDisk.ClearAll();
     return(View());
 }
        public void CompactDiskConstructor_CreatesInstanceOfCompactDisk_CompactDisk()
        {
            CompactDisk newCompactDisk = new CompactDisk("disktitle");

            Assert.AreEqual(typeof(CompactDisk), newCompactDisk.GetType());
        }
 public void Dispose()
 {
     CompactDisk.ClearAll();
 }
Exemple #13
0
 public CompactDiskController()
 {
     this.Cd = new CompactDisk("Abbey Road", "The Beatles");
 }