public void TracksControllerDelete() { var tracksController = new TracksController(null, null); var result = tracksController.Delete(null); Assert.IsNotNull(result); }
public async void deleteSuccess() { var mockRepository = new Mock <ITrackRepository>(); mockRepository.Setup(a => a.Delete(0)).ReturnsAsync(true); var controller = new TracksController(mockRepository.Object); var response = await controller.Delete(0); Assert.IsType <OkResult>(response); }
public async void deleteFailure() { var mockRepository = new Mock <ITrackRepository>(); mockRepository.Setup(a => a.Delete(0)).ReturnsAsync(false); var controller = new TracksController(mockRepository.Object); var response = await controller.Delete(0); Assert.IsType <NotFoundResult>(response); }
public void Delete_ShouldCallService() { mockService.Setup(x => x.DeleteTrack(new TrackModel() { })); mockService.Setup(x => x.GetTrack(1)).Returns(new TrackModel() { }); //_sut.Delete(new TrackDto() { }); _sut.Delete(1); mockService.Verify(x => x.DeleteTrack(It.IsAny <TrackModel>()), Times.Once); }
public async Task Delete_given_id_deletes_track() { var track = new TrackCreateDTO() { Name = "Awesome Track", MaxCars = 12, LengthInMeters = 5000 }; var repo = new TrackRepository(context); await repo.Create(track); var controller = new TracksController(repo); var response = await controller.Delete(1); Assert.IsType <OkResult>(response); Assert.Null(context.Tracks.Find(1)); }