Ejemplo n.º 1
0
        public void GivenSampleToken_ThenTokenHasExpectedValue()
        {
            var command = IssueBrowseTokenCommand.Create("AB12ab", SampleUserId);

            var sut = new IssueBrowseTokenCommandHandler(_authorizationContextMock.Object, _timeProviderMock.Object);

            sut.Handle(command, CancellationToken.None).Wait();

            _addedTokens.Should().Contain(token => token.Id == "AB12ab");
        }
Ejemplo n.º 2
0
        public void GivenSampleToken_ThenExpirationTimeIsInTheFuture()
        {
            var command = IssueBrowseTokenCommand.Create("AB12ab", SampleUserId);

            var sut = new IssueBrowseTokenCommandHandler(_authorizationContextMock.Object, _timeProviderMock.Object);

            sut.Handle(command, CancellationToken.None).Wait();

            _addedTokens.Should().OnlyContain(token => token.ExpirationTime > _givenDate);
        }
Ejemplo n.º 3
0
        public void GivenSampleToken_ThenSingleTokenIsAdded()
        {
            var command = IssueBrowseTokenCommand.Create("AB12ab", SampleUserId);

            var sut = new IssueBrowseTokenCommandHandler(_authorizationContextMock.Object, _timeProviderMock.Object);

            sut.Handle(command, CancellationToken.None).Wait();

            _addedTokens.Count.Should().Be(1);
        }
Ejemplo n.º 4
0
        public void GivenSampleToken_ThenExpiredTokensAreRemoved()
        {
            var expectedRemovedTokens = _givenBrowseTokens.Where(token => token.ExpirationTime <= _givenDate);
            var command = IssueBrowseTokenCommand.Create("AB12ab", SampleUserId);

            var sut = new IssueBrowseTokenCommandHandler(_authorizationContextMock.Object, _timeProviderMock.Object);

            sut.Handle(command, CancellationToken.None).Wait();

            _removedTokens.Should().BeEquivalentTo(expectedRemovedTokens);
        }