Example #1
0
        public async Task GiveSession_WhenNoRefresh_ThanLastUseIsSame()
        {
            // Arrange
            IClientSessionHandle session = await _mongoClient.StartSessionAsync();

            List <ServerSession> serverSessionsFirst = await GetServerSessions();

            // Act
            await Task.Delay(TimeSpan.FromSeconds(1));

            List <ServerSession> serverSessionsSecond = await GetServerSessions();

            // Assert
            ServerSession sessionFirstUse = serverSessionsFirst
                                            .First(s => s.Id == session.GetSessionId());
            ServerSession sessionSecondUse = serverSessionsSecond
                                             .First(s => s.Id == session.GetSessionId());

            Assert.True(sessionSecondUse.LastUse == sessionFirstUse.LastUse);
        }
Example #2
0
        public async Task GiveSession_WhenRefresh_ThenOkResult()
        {
            // Arrange
            IClientSessionHandle session = await _mongoClient.StartSessionAsync();

            // Act
            BsonDocument result = await _mongoClient
                                  .RefreshSessionAsync(session.GetSessionId(), default);

            // Assert
            result.MatchSnapshot();
        }