public void Update_NameIncorrect_ShouldThrownPublisherIncorrectException() { var publisher = Publishers.First(); PublisherDto dto = new PublisherDto(); Assert.Throws <PublisherIncorrectException>(async() => await PublishersService.Update(publisher.Id, dto)); }
public void Update_ExistingName_ShouldThrownPublisherDublicateException() { var existingPublisher = Publishers.First(); PublisherDto dto = new PublisherDto() { Id = existingPublisher.Id, Name = existingPublisher.Name }; Assert.Throws <PublisherDublicateException>(async() => await PublishersService.Update(dto.Id, dto)); }
public async Task Update_ShouldUpdate() { var publisher = Publishers.First(); PublisherDto dto = new PublisherDto() { Id = publisher.Id, Name = "very updated name" }; await PublishersService.Update(publisher.Id, dto); Assert.That(Publishers.Single(x => x.Id == dto.Id).Name, Is.EqualTo(dto.Name)); }
public ActionResult Update(ResponsePublisherViewModel responsePublisherViewModel) { var publisherViewModel = publishersService.Update(responsePublisherViewModel); return(Json(new[] { publisherViewModel })); }