public async Task ExecuteAsync_WhenCalled_AssertRefreshableTokenWasCalledOnCommand()
        {
            CommandHandler sut = CreateSut();

            Mock <IRefreshTokenForMicrosoftGraphCommand> commandMock = CreateCommandMock();
            await sut.ExecuteAsync(commandMock.Object);

            commandMock.Verify(m => m.RefreshableToken, Times.Once);
        }
        public async Task ExecuteAsync_WhenCalled_ReturnRefreshableTokenFromMicrosoftGraphRepository()
        {
            IRefreshableToken refreshableToken = _fixture.BuildRefreshableTokenMock().Object;
            CommandHandler    sut = CreateSut(refreshableToken);

            IRefreshTokenForMicrosoftGraphCommand command = CreateCommandMock().Object;
            IRefreshableToken result = await sut.ExecuteAsync(command);

            Assert.That(result, Is.EqualTo(refreshableToken));
        }
        public async Task ExecuteAsync_WhenCalled_AssertRefreshTokenAsyncWasCalledOnMicrosoftGraphRepository()
        {
            CommandHandler sut = CreateSut();

            Uri redirectUri = CreateUri();
            IRefreshableToken refreshableToken            = _fixture.BuildRefreshableTokenMock().Object;
            IRefreshTokenForMicrosoftGraphCommand command = CreateCommandMock(redirectUri, refreshableToken).Object;
            await sut.ExecuteAsync(command);

            _microsoftGraphRepositoryMock.Verify(m => m.RefreshTokenAsync(It.Is <Uri>(value => value == redirectUri), It.Is <IRefreshableToken>(value => value == refreshableToken)), Times.Once);
        }
        public void ExecuteAsync_WhenCommandIsNull_ThrowsArgumentNullException()
        {
            CommandHandler sut = CreateSut();

            ArgumentNullException result = Assert.ThrowsAsync <ArgumentNullException>(async() => await sut.ExecuteAsync(null));

            Assert.That(result.ParamName, Is.EqualTo("command"));
        }