Ejemplo n.º 1
0
 public ActionResult Put(int id, [FromBody] Song song)
 {
     if (_songGetByIdService.GetItemById(id) == null)
     {
         return(this.StatusCode((int)HttpStatusCode.NotFound));
     }
     _songUpdateService.UpdateItem(id, song);
     return(this.Ok());
 }
Ejemplo n.º 2
0
        public void UpdateItemTest()
        {
            Song _song = new Song();

            _song.SongId    = 0;
            _song.AlbumId   = 0;
            _song.SongTitle = "In The End";
            var sRepo = new Mock <ISRepo>();

            sRepo.Setup(x => x.Update(0, _song)).Returns(_song);
            var songUpdateService = new SongUpdateService(sRepo.Object);

            Assert.AreEqual(songUpdateService.UpdateItem(0, _song), _song);
        }