---
title: "Comment by Roman Izosimov on \"Unit Tests Done Right\" | Hashnode"
description: "I know it is out of the scope of the topic but I&#39;d like to know your opinion, what is the strategy of using cancellation tokens in your examples. I guess th"
url: "https://hashnode.com/posts/unit-tests-done-right/626ef1d7a2d355d4df441063/comment/62bb2a697131dfe7a8b5963b"
---

[Discussion](https://hashnode.com/posts/unit-tests-done-right/626ef1d7a2d355d4df441063)

Comment [Unit Tests Done Right](https://hashnode.com/posts/unit-tests-done-right/626ef1d7a2d355d4df441063)

[Jun 28, 2022](https://hashnode.com/posts/unit-tests-done-right/626ef1d7a2d355d4df441063/comment/62bb2a697131dfe7a8b5963b)

I know it is out of the scope of the topic but I'd like to know your opinion, what is the strategy of using cancellation tokens in your examples. I guess the `UserManager` is invoked by an action (as part of a controller) and then from `UserManager` you call a repo and pass ct to it. Inside repo you pass ct to linq async operation. What is the benefit to do that? What is the source of the ct? Who and why might cancel the token in the presented chain of calls?

[Aleksei Zagoskin](https://hashnode.com/@azagoskin)

[Jul 8, 2022](https://hashnode.com/posts/unit-tests-done-right/626ef1d7a2d355d4df441063/comment/62bb2a697131dfe7a8b5963b#reply-62c86ad555f37390f97ca391)

Good point! Your assumption is absolutely correct, cancellation tokens come from controllers and do the cancellation, for instance, if/when a connection between the client and the server is interrupted. In these cases we may want to cancel "get" queries while let others finish.

[Roman Izosimov](https://hashnode.com/@RomanIzosimov)

[Jul 11, 2022](https://hashnode.com/posts/unit-tests-done-right/626ef1d7a2d355d4df441063/comment/62bb2a697131dfe7a8b5963b#reply-62cc566e2ff140b8fe05b022)

[Alexey Zagoskin](https://hashnode.com/@azagoskin) yes, agree, it is good to cancel a token when/if a connection is interrupted, but I've never used this before. Could you please refer to a web page or example about that, I mean how to detect the interruption and react.
