public async Task EndSession_TimeoutSessionDoesNotExist_ReturnsNull() { // Arrange var cxn = new SqlConnectionWrapperMock(); var repository = new SqlSessionsRepository(cxn.Object); var guid = new Guid("00000000000000000000000000000000"); DateTime?timeoutTime = DateTime.UtcNow; var sessions = new Session[] { }; cxn.SetupQueryAsync("[AdminStore].EndSession", new Dictionary <string, object> { { "SessionId", guid }, { "TimeoutTime", timeoutTime } }, sessions); // Act Session result = await repository.EndSession(guid, timeoutTime); // Assert cxn.Verify(); Assert.IsNull(result); }
public async Task EndSession_LogoutSessionExists_ReturnsFirst() { // Arrange var cxn = new SqlConnectionWrapperMock(); var repository = new SqlSessionsRepository(cxn.Object); var guid = new Guid("12345678901234567890123456789012"); var sessions = new[] { new Session { SessionId = guid } }; cxn.SetupQueryAsync("[AdminStore].EndSession", new Dictionary <string, object> { { "SessionId", guid }, { "TimeoutTime", null } }, sessions); // Act Session result = await repository.EndSession(guid); // Assert cxn.Verify(); Assert.AreEqual(sessions[0], result); }