From 23fd32e4622c7fcd840d1221c2ca4699e6cf80d0 Mon Sep 17 00:00:00 2001 From: Vincent He Date: Tue, 9 Aug 2016 12:20:16 +0800 Subject: [PATCH] Make changes to remove VS2015 sematic in test code --- .../DataStoreManager/DefaultDataStoreManager.cs | 8 +++++++- .../Microsoft.OData.Service.Library/Utils/LibraryUtils.cs | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/test/ODataEndToEnd/Microsoft.OData.Service.Library/DataStoreManager/DefaultDataStoreManager.cs b/test/ODataEndToEnd/Microsoft.OData.Service.Library/DataStoreManager/DefaultDataStoreManager.cs index cf4a0118..0a9ec8d1 100644 --- a/test/ODataEndToEnd/Microsoft.OData.Service.Library/DataStoreManager/DefaultDataStoreManager.cs +++ b/test/ODataEndToEnd/Microsoft.OData.Service.Library/DataStoreManager/DefaultDataStoreManager.cs @@ -147,7 +147,13 @@ public void StopTimer() private Timer InitTimer() { DataStoreTimer = new Timer(_dataStoreLifeTime); - DataStoreTimer.Elapsed += (sender, args) => { _timerTimeoutHandler?.Invoke(this, args); }; + DataStoreTimer.Elapsed += (sender, args) => + { + if (_timerTimeoutHandler != null) + { + _timerTimeoutHandler.Invoke(this, args); + } + }; DataStoreTimer.Start(); return DataStoreTimer; } diff --git a/test/ODataEndToEnd/Microsoft.OData.Service.Library/Utils/LibraryUtils.cs b/test/ODataEndToEnd/Microsoft.OData.Service.Library/Utils/LibraryUtils.cs index 1b6f8736..cbd12cff 100644 --- a/test/ODataEndToEnd/Microsoft.OData.Service.Library/Utils/LibraryUtils.cs +++ b/test/ODataEndToEnd/Microsoft.OData.Service.Library/Utils/LibraryUtils.cs @@ -8,7 +8,12 @@ public static class LibraryUtils static public string GetSessionId() { var session = System.Web.HttpContext.Current.Session; - return session?.SessionID; + if (session != null) + { + return session.SessionID; + } + + return null; } } } \ No newline at end of file