public void Create_WhenCalledWithRefreshableTokenBasedCommand_AssertExpiresWasCalledOnRefreshableTokenBasedCommand()
        {
            Mock <IRefreshableTokenBasedCommand> refreshableTokenBasedCommandMock = _fixture.BuildRefreshableTokenBasedCommandMock();

            Sut.Create(refreshableTokenBasedCommandMock.Object);

            refreshableTokenBasedCommandMock.Verify(m => m.Expires, Times.Once);
        }
        public void Create_WhenCalledWithRefreshableTokenBasedQuery_AssertRefreshTokenWasCalledOnRefreshableTokenBasedQuery()
        {
            Mock <IRefreshableTokenBasedQuery> refreshableTokenBasedQueryMock = _fixture.BuildRefreshableTokenBasedQueryMock();

            Sut.Create(refreshableTokenBasedQueryMock.Object);

            refreshableTokenBasedQueryMock.Verify(m => m.RefreshToken, Times.Once);
        }
        public void Create_WhenCalledWithRefreshableTokenBasedCommand_ReturnsRefreshableTokenWithValuesFromRefreshableTokenBasedCommand()
        {
            string   tokenType    = _fixture.Create <string>();
            string   accessToken  = _fixture.Create <string>();
            string   refreshToken = _fixture.Create <string>();
            DateTime expires      = _fixture.Create <DateTime>();
            IRefreshableTokenBasedCommand refreshableTokenBasedCommand = _fixture.BuildRefreshableTokenBasedCommandMock(tokenType, accessToken, refreshToken, expires).Object;

            IRefreshableToken result = Sut.Create(refreshableTokenBasedCommand);

            Assert.That(result, Is.Not.Null);
            Assert.That(result.TokenType, Is.EqualTo(tokenType));
            Assert.That(result.AccessToken, Is.EqualTo(accessToken));
            Assert.That(result.RefreshToken, Is.EqualTo(refreshToken));
            Assert.That(result.Expires, Is.EqualTo(expires));
        }
        public void Create_WhenRefreshableTokenBasedCommandIsNull_ThrowsArgumentNullException()
        {
            ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => Sut.Create((IRefreshableTokenBasedCommand)null));

            // ReSharper disable PossibleNullReferenceException
            Assert.That(result.ParamName, Is.EqualTo("refreshableTokenBasedCommand"));
            // ReSharper restore PossibleNullReferenceException
        }