public void Delete_Publisher_With_Wrong_Id() { // Arrange const int WrongId = 89; // Act _publisherService.Delete(WrongId); }
public void DeletePublisher_NotExistedPublisherName__ExeptionEntityNotFound() { var notExistPublisherId = Guid.NewGuid(); _uow.Setup(uow => uow.Publishers.GetById(notExistPublisherId)).Returns(null as Publisher); _uow.Setup(uow => uow.Publishers.Delete(notExistPublisherId)); Assert.Throws <EntityNotFound>(() => _sut.Delete(notExistPublisherId)); }
public bool DeletePublisher(PublisherData p) { return(PublisherService.Delete(new Publisher() { ID = p.ID, name = p.name })); }
public async Task <IActionResult> DeleteConfirmed(int id) { var publisher = await _publisherService.Get(id); await _publisherService.Delete(publisher); return(RedirectToAction(nameof(Index))); }
public void EditOrder_ShouldCallGetSingleOnceWhenCompanyName() { // Act _publisherService.Delete(_publisher.CompanyName); // Assert _publisherRepository.Verify(p => p.FirstOrDefault(It.IsAny <Expression <Func <Publisher, bool> > >())); }
public ActionResult <Publisher> DeletePublisher(int id) { try { return(service.Delete(id)); } catch (Exception error) { return(Conflict(error.Message)); } }
public async Task Delete_NotFound() { var param = DateTime.Now.ToString(); var mock = new Mock <ILogger>(); mock.Setup(o => o.Log(param)).Returns(new PublisherDto { PublisherName = "test" }.PublisherName); var service = new PublisherService(dataContext, mock.Object); await service.Delete(555); }
//[HttpDelete] public async Task <IActionResult> Delete(int id) { try { await m_publisherService.Delete(id); return(RedirectToAction(nameof(Index))); } catch { return(RedirectToAction(nameof(Index))); } }
public void DeletePost() { AutoMapperDataConfig.RegisterMappings(); PublisherService publisherService = new PublisherService(new PostRepository(), new TagRepository()); int maxId = publisherService.GetAllPosts().Max(x => x.Id); var postDto = new PostDto() { Id = maxId }; publisherService.Delete(postDto); var postDeleted = publisherService.GetById(maxId); Assert.IsNull(postDeleted); }
public bool Delete(PLPublisher item) { if (PLValidation.IsItemNull(item)) { Console.WriteLine("Cant add delete"); return(false); } bool deleteResult = _curPublWorkerService.Delete(new BLLPublisher { Id = item.Id, PublisherName = item.PublisherName, LicenseNumber = item.LicenseNumber }); if (deleteResult) { Console.WriteLine($"Item with Id={item.Id} was deleted"); } else { Console.WriteLine($"Item delete error"); } return(deleteResult); }
public IActionResult Delete(int id) { _publisherService.Delete(id); return(RedirectToAction("Index", "Publisher")); }
/// <summary> /// 删除 /// </summary> /// <param name="id"></param> public void Delete(int id) { ps.Delete(id); }
public async Task DeleteTest() { var publisher = new Publisher(1, "Moq"); await publisherService.Delete(publisher); }