public async Task Delete_Deletes_Subscription_200() { // Arrange var logger = new Mock <ILogger <SubscriptionsController> >(); var bookSubscriptionRepository = new Mock <IBookSubscriptionsRepository>(); bookSubscriptionRepository.Setup(s => s.DeleteAsync(It.IsAny <BookSubscriptionServiceModel>())).Returns(Task.FromResult(true)); var bookRepository = new Mock <IBookRepository>(); var context = new ControllerContext { HttpContext = new DefaultHttpContext { User = new ClaimsPrincipal(new[] { new ClaimsIdentity(new[] { new Claim(ClaimTypes.NameIdentifier, "test_name_identifier") }) }) } }; var bookSubsController = new SubscriptionsController(logger.Object, bookSubscriptionRepository.Object, bookRepository.Object); bookSubsController.ControllerContext = context; // Act var deleteResponse = await bookSubsController.DeleteAsync("IDDQD"); // Assert Assert.IsType <OkResult>(deleteResponse); }