Beispiel #1
0
        public async Task ThenWillGetUserSessionFromService()
        {
            _cosmosDbContext = new Mock <ICosmosUserSessionDbContext>(MockBehavior.Strict);
            _cosmosDbContext.Setup(x => x.GetUserSessionAsync(_userId)).ReturnsAsync(new Domain.UserSession());

            var sut = new GetUserSessionQueryHandler(_cosmosDbContext.Object);

            await sut.Handle(new GetUserSessionQuery()
            {
                UserId = _userId
            });

            _cosmosDbContext.Verify(x => x.GetUserSessionAsync(_userId), Times.Once);
        }
Beispiel #2
0
        public async Task AndTheResponseWillBeValid()
        {
            _cosmosDbContext = new Mock <ICosmosUserSessionDbContext>(MockBehavior.Strict);
            _cosmosDbContext.Setup(x => x.GetUserSessionAsync(_userId)).ReturnsAsync(new Domain.UserSession());

            var sut = new GetUserSessionQueryHandler(_cosmosDbContext.Object);

            var response = await sut.Handle(new GetUserSessionQuery()
            {
                UserId = _userId
            });

            response.Should().NotBeNull();
            response.UserSession.Should().NotBeNull();
        }