예제 #1
0
            public async Task WhenSessionIdIsNullOrEmpty_ReturnNull()
            {
                var serviceUnderTest = new SessionService(_cosmosService, _sessionConfig, _sessionClient);
                var sessionId        = await serviceUnderTest.CheckForExistingUserSession(null);

                sessionId.Should().BeFalse();
            }
예제 #2
0
            public async Task WhenNoUserSessionExists_ReturnFalse()
            {
                _cosmosService.ReadItemAsync(Arg.Any <string>(), Arg.Any <string>(), CosmosCollection.Session).Returns(Task.FromResult(new HttpResponseMessage(HttpStatusCode.NotFound)));
                var serviceUnderTest = new SessionService(_cosmosService, _sessionConfig, _sessionClient);

                var sessionId = await serviceUnderTest.CheckForExistingUserSession("session-g2454t4f");

                sessionId.Should().BeFalse();
            }
예제 #3
0
            public async Task WhenSuccessfulCallButEmptyPartitionKey_ReturnFalse()
            {
                var primaryKey  = "session2-g2454t4f";
                var userSession = new UserSession
                {
                    UserSessionId = "g2454t4f"
                };

                _cosmosService.ReadItemAsync(Arg.Any <string>(), Arg.Any <string>(), CosmosCollection.Session).Returns(Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)
                {
                    Content = new StringContent(JsonConvert.SerializeObject(userSession))
                }));
                var serviceUnderTest = new SessionService(_cosmosService, _sessionConfig, _sessionClient);

                var sessionId = await serviceUnderTest.CheckForExistingUserSession(primaryKey);

                sessionId.Should().BeFalse();
            }