commit 3729dcaedd5f91ee2263ea3529650994f5482b81
Author: A-Konig <alex-nebulae@seznam.cz>
Date:   Sun Jun 6 12:03:44 2021 +0200

    re #9037 Empty input testing

diff --git a/Server/ServerApp/Parser/Parsers/JisParser.cs b/Server/ServerApp/Parser/Parsers/JisParser.cs
index d35a3cd..a67e121 100644
--- a/Server/ServerApp/Parser/Parsers/JisParser.cs
+++ b/Server/ServerApp/Parser/Parsers/JisParser.cs
@@ -89,7 +89,7 @@ namespace ServerApp.Parser.Parsers
             List<ActivityInfo> jisInfo = new List<ActivityInfo>();
             
             List<JisInstance> list =  loader.LoadJisFile(path);
-            if (list == null)
+            if (list == null || list.Count == 0)
                 return jisInfo;
 
             // data for each faculty
@@ -171,7 +171,7 @@ namespace ServerApp.Parser.Parsers
             List<ActivityInfo> jisInfo = new List<ActivityInfo>();
 
             List<JisInstance> list = loader.LoadJisFile(path);
-            if (list == null)
+            if (list == null || list.Count == 0)
                 return jisInfo;
 
             // data for each faculty
diff --git a/Server/ServerApp/Parser/Parsers/LogInParser.cs b/Server/ServerApp/Parser/Parsers/LogInParser.cs
index 40c6f69..ffa6a88 100644
--- a/Server/ServerApp/Parser/Parsers/LogInParser.cs
+++ b/Server/ServerApp/Parser/Parsers/LogInParser.cs
@@ -87,7 +87,7 @@ namespace ServerApp.Parser.Parsers
             List<ActivityInfo> loginInfo = new List<ActivityInfo>();
 
             List<LogInInstance> list = loader.LoadLoginFile(path);
-            if (list == null)
+            if (list == null || list.Count == 0)
                 return loginInfo;
 
             // data for each faculty
@@ -173,7 +173,7 @@ namespace ServerApp.Parser.Parsers
             List<ActivityInfo> loginInfo = new List<ActivityInfo>();
             
             List<LogInInstance> list = loader.LoadLoginFile(path);
-            if (list == null)
+            if (list == null || list.Count == 0)
                 return loginInfo;
 
             // min/max hour taken into account
diff --git a/Server/ServerApp/Parser/Parsers/WeatherParser.cs b/Server/ServerApp/Parser/Parsers/WeatherParser.cs
index 499c5b2..07d667a 100644
--- a/Server/ServerApp/Parser/Parsers/WeatherParser.cs
+++ b/Server/ServerApp/Parser/Parsers/WeatherParser.cs
@@ -90,7 +90,7 @@ namespace ServerApp.Parser.Parsers
             List<WeatherInfo> weatherInfo = new List<WeatherInfo>();
 
             List<WeatherInstance> list = loader.LoadWeatherFile(path);
-            if (list == null)
+            if (list == null || list.Count == 0)
                 return weatherInfo;
 
             // array with data [temp, rain, wind, lum]
@@ -165,8 +165,8 @@ namespace ServerApp.Parser.Parsers
             List<WeatherInfo> weatherInfo = new List<WeatherInfo>();
 
             List<WeatherInstance> list = loader.LoadWeatherFile(path);
-            if (list == null)
-                return weatherInfo;
+            if (list == null || list.Count == 0)
+                    return weatherInfo;
 
             // min/max hour taken into account
             int[] minmaxHour = new int[] { 7, 18 };
diff --git a/Server/ServerAppFunctionalTests/ParserTests/JisParserTesting.cs b/Server/ServerAppFunctionalTests/ParserTests/JisParserTesting.cs
index 9f15f2b..ec08cb0 100644
--- a/Server/ServerAppFunctionalTests/ParserTests/JisParserTesting.cs
+++ b/Server/ServerAppFunctionalTests/ParserTests/JisParserTesting.cs
@@ -162,9 +162,80 @@ namespace ServerAppFunctionalTests.ParserTests
 
             Assert.AreEqual(0, retVal.Count);
         }
+
+        [TestMethod]
+        public void ParseJisDayEmpty()
+        {
+            string path = "";
+            List<WeatherInstance> data = new List<WeatherInstance>();
+
+            Mock<IDataLoader> dl = new Mock<IDataLoader>();
+            dl.Setup(m => m.LoadWeatherFile(path)).Returns(data);
+
+            JisParser target = new JisParser(dl.Object);
+            PrivateObject obj = new PrivateObject(target);
+
+            List<ActivityInfo> retVal = (List<ActivityInfo>)obj.Invoke("ProcessOneJisFileAsDays", path, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2001, 1, 1, 11, 0, 0));
+
+            Assert.AreEqual(0, retVal.Count);
+        }
+
+
+        [TestMethod]
+        public void ParseJisDayNull()
+        {
+            string path = "";
+            List<WeatherInstance> data = null;
+
+            Mock<IDataLoader> dl = new Mock<IDataLoader>();
+            dl.Setup(m => m.LoadWeatherFile(path)).Returns(data);
+
+            JisParser target = new JisParser(dl.Object);
+            PrivateObject obj = new PrivateObject(target);
+
+            List<ActivityInfo> retVal = (List<ActivityInfo>)obj.Invoke("ProcessOneJisFileAsDays", path, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2001, 1, 1, 11, 0, 0));
+
+            Assert.AreEqual(0, retVal.Count);
+        }
         #endregion
 
         #region Parse hours
+
+        [TestMethod]
+        public void ParseJisEmpty()
+        {
+            string path = "";
+            List<WeatherInstance> data = new List<WeatherInstance>();
+
+            Mock<IDataLoader> dl = new Mock<IDataLoader>();
+            dl.Setup(m => m.LoadWeatherFile(path)).Returns(data);
+
+            JisParser target = new JisParser(dl.Object);
+            PrivateObject obj = new PrivateObject(target);
+
+            List<ActivityInfo> retVal = (List<ActivityInfo>)obj.Invoke("ProcessOneJisFileAsIntervals", path, 2, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2001, 1, 1, 11, 0, 0));
+
+            Assert.AreEqual(0, retVal.Count);
+        }
+
+
+        [TestMethod]
+        public void ParseJisNull()
+        {
+            string path = "";
+            List<WeatherInstance> data = null;
+
+            Mock<IDataLoader> dl = new Mock<IDataLoader>();
+            dl.Setup(m => m.LoadWeatherFile(path)).Returns(data);
+
+            JisParser target = new JisParser(dl.Object);
+            PrivateObject obj = new PrivateObject(target);
+
+            List<ActivityInfo> retVal = (List<ActivityInfo>)obj.Invoke("ProcessOneJisFileAsIntervals", path, 2, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2001, 1, 1, 11, 0, 0));
+
+            Assert.AreEqual(0, retVal.Count);
+        }
+
         [TestMethod]
         public void ParseJisHourlyOne()
         {
diff --git a/Server/ServerAppFunctionalTests/ParserTests/LoginParserTesting.cs b/Server/ServerAppFunctionalTests/ParserTests/LoginParserTesting.cs
index 64b87d6..e283558 100644
--- a/Server/ServerAppFunctionalTests/ParserTests/LoginParserTesting.cs
+++ b/Server/ServerAppFunctionalTests/ParserTests/LoginParserTesting.cs
@@ -175,9 +175,79 @@ namespace ServerAppFunctionalTests.ParserTests
 
             Assert.AreEqual(0, retVal.Count);
         }
+
+        [TestMethod]
+        public void ParseLoginDayEmpty()
+        {
+            string path = "";
+            List<WeatherInstance> data = new List<WeatherInstance>();
+
+            Mock<IDataLoader> dl = new Mock<IDataLoader>();
+            dl.Setup(m => m.LoadWeatherFile(path)).Returns(data);
+
+            LogInParser target = new LogInParser(dl.Object);
+            PrivateObject obj = new PrivateObject(target);
+
+            List<ActivityInfo> retVal = (List<ActivityInfo>)obj.Invoke("ProcessOneLogInFileAsDays", path, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2001, 1, 1, 11, 0, 0));
+
+            Assert.AreEqual(0, retVal.Count);
+        }
+
+
+        [TestMethod]
+        public void ParseLoginDayNull()
+        {
+            string path = "";
+            List<WeatherInstance> data = null;
+
+            Mock<IDataLoader> dl = new Mock<IDataLoader>();
+            dl.Setup(m => m.LoadWeatherFile(path)).Returns(data);
+
+            LogInParser target = new LogInParser(dl.Object);
+            PrivateObject obj = new PrivateObject(target);
+
+            List<ActivityInfo> retVal = (List<ActivityInfo>)obj.Invoke("ProcessOneLogInFileAsDays", path, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2001, 1, 1, 11, 0, 0));
+
+            Assert.AreEqual(0, retVal.Count);
+        }
         #endregion
 
         #region Parse hours
+        [TestMethod]
+        public void ParseLoginEmpty()
+        {
+            string path = "";
+            List<WeatherInstance> data = new List<WeatherInstance>();
+
+            Mock<IDataLoader> dl = new Mock<IDataLoader>();
+            dl.Setup(m => m.LoadWeatherFile(path)).Returns(data);
+
+            LogInParser target = new LogInParser(dl.Object);
+            PrivateObject obj = new PrivateObject(target);
+
+            List<ActivityInfo> retVal = (List<ActivityInfo>)obj.Invoke("ProcessOneLoginFileAsIntervals", path, 2, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2001, 1, 1, 11, 0, 0));
+
+            Assert.AreEqual(0, retVal.Count);
+        }
+
+
+        [TestMethod]
+        public void ParseLoginNull()
+        {
+            string path = "";
+            List<WeatherInstance> data = null;
+
+            Mock<IDataLoader> dl = new Mock<IDataLoader>();
+            dl.Setup(m => m.LoadWeatherFile(path)).Returns(data);
+
+            LogInParser target = new LogInParser(dl.Object);
+            PrivateObject obj = new PrivateObject(target);
+
+            List<ActivityInfo> retVal = (List<ActivityInfo>)obj.Invoke("ProcessOneLoginFileAsIntervals", path, 2, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2001, 1, 1, 11, 0, 0));
+
+            Assert.AreEqual(0, retVal.Count);
+        }
+
         [TestMethod]
         public void ParseLoginHourlyOne()
         {
diff --git a/Server/ServerAppFunctionalTests/ParserTests/WeatherParserTesting.cs b/Server/ServerAppFunctionalTests/ParserTests/WeatherParserTesting.cs
index 18a537e..7158f1a 100644
--- a/Server/ServerAppFunctionalTests/ParserTests/WeatherParserTesting.cs
+++ b/Server/ServerAppFunctionalTests/ParserTests/WeatherParserTesting.cs
@@ -60,9 +60,6 @@ namespace ServerAppFunctionalTests.ParserTests
             WeatherParser target = new WeatherParser(dl.Object);
             PrivateObject obj = new PrivateObject(target);
 
-            List<ActivityInfo> jis = new List<ActivityInfo>();
-            List<ActivityInfo> pc = new List<ActivityInfo>();
-
             List<WeatherInfo> retVal = (List<WeatherInfo>)obj.Invoke("ProcessOneWeatherFileAsDays", path, new DateTime(2000, 1, 1, 9, 0, 0), new DateTime(2000, 1, 1, 15, 0, 0));
 
             Assert.AreEqual(1, retVal.Count);
@@ -90,9 +87,6 @@ namespace ServerAppFunctionalTests.ParserTests
             WeatherParser target = new WeatherParser(dl.Object);
             PrivateObject obj = new PrivateObject(target);
 
-            List<ActivityInfo> jis = new List<ActivityInfo>();
-            List<ActivityInfo> pc = new List<ActivityInfo>();
-
             List<WeatherInfo> retVal = (List<WeatherInfo>)obj.Invoke("ProcessOneWeatherFileAsDays", path, new DateTime(2000, 1, 1), new DateTime(2001, 1, 1));
 
             Assert.AreEqual(2, retVal.Count);
@@ -121,15 +115,46 @@ namespace ServerAppFunctionalTests.ParserTests
             WeatherParser target = new WeatherParser(dl.Object);
             PrivateObject obj = new PrivateObject(target);
 
-            List<ActivityInfo> jis = new List<ActivityInfo>();
-            List<ActivityInfo> pc = new List<ActivityInfo>();
-
             List<WeatherInfo> retVal = (List<WeatherInfo>)obj.Invoke("ProcessOneWeatherFileAsDays", path, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2000, 1, 1, 11, 0, 0));
 
             Assert.AreEqual(1, retVal.Count);
             Assert.AreEqual(new WeatherInfo(new DateTime(2000, 1, 1, 7, 0, 0), 6, 100, 1, 10_000, 18 - 7), retVal[0]);
             //Assert.AreEqual(new WeatherInfo(new DateTime(2000, 2, 1, 7, 0, 0), 10, 25, 2, 10_000, 18 - 7), retVal[1]);
         }
+
+        [TestMethod]
+        public void ParseWeatherDayEmpty()
+        {
+            string path = "";
+            List<WeatherInstance> data = new List<WeatherInstance>();
+
+            Mock<IDataLoader> dl = new Mock<IDataLoader>();
+            dl.Setup(m => m.LoadWeatherFile(path)).Returns(data);
+
+            WeatherParser target = new WeatherParser(dl.Object);
+            PrivateObject obj = new PrivateObject(target);
+
+            List<WeatherInfo> retVal = (List<WeatherInfo>)obj.Invoke("ProcessOneWeatherFileAsDays", path, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2001, 1, 1, 11, 0, 0));
+
+            Assert.AreEqual(0, retVal.Count);
+        }
+
+        [TestMethod]
+        public void ParseWeatherDayNull()
+        {
+            string path = "";
+            List<WeatherInstance> data = null;
+
+            Mock<IDataLoader> dl = new Mock<IDataLoader>();
+            dl.Setup(m => m.LoadWeatherFile(path)).Returns(data);
+
+            WeatherParser target = new WeatherParser(dl.Object);
+            PrivateObject obj = new PrivateObject(target);
+
+            List<WeatherInfo> retVal = (List<WeatherInfo>)obj.Invoke("ProcessOneWeatherFileAsDays", path, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2001, 1, 1, 11, 0, 0));
+
+            Assert.AreEqual(0, retVal.Count);
+        }
         #endregion
 
         #region Parse hours
@@ -149,9 +174,6 @@ namespace ServerAppFunctionalTests.ParserTests
             WeatherParser target = new WeatherParser(dl.Object);
             PrivateObject obj = new PrivateObject(target);
 
-            List<ActivityInfo> jis = new List<ActivityInfo>();
-            List<ActivityInfo> pc = new List<ActivityInfo>();
-
             List<WeatherInfo> retVal = (List<WeatherInfo>)obj.Invoke("ProcessOneWeatherFileAsIntervals", path, 2, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2001, 1, 1, 11, 0, 0));
 
             Assert.AreEqual(1, retVal.Count);
@@ -186,9 +208,6 @@ namespace ServerAppFunctionalTests.ParserTests
             WeatherParser target = new WeatherParser(dl.Object);
             PrivateObject obj = new PrivateObject(target);
 
-            List<ActivityInfo> jis = new List<ActivityInfo>();
-            List<ActivityInfo> pc = new List<ActivityInfo>();
-
             List<WeatherInfo> retVal = (List<WeatherInfo>)obj.Invoke("ProcessOneWeatherFileAsIntervals", path, 2, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2001, 1, 1, 11, 0, 0));
 
             Assert.AreEqual(5, retVal.Count);
@@ -208,6 +227,40 @@ namespace ServerAppFunctionalTests.ParserTests
             Assert.AreEqual(new DateTime(2000, 2, 1, 16, 0, 0), retVal[4].startTime);
         }
 
+        [TestMethod]
+        public void ParseWeatherEmpty()
+        {
+            string path = "";
+            List<WeatherInstance> data = new List<WeatherInstance>();
+
+            Mock<IDataLoader> dl = new Mock<IDataLoader>();
+            dl.Setup(m => m.LoadWeatherFile(path)).Returns(data);
+
+            WeatherParser target = new WeatherParser(dl.Object);
+            PrivateObject obj = new PrivateObject(target);
+
+            List<WeatherInfo> retVal = (List<WeatherInfo>)obj.Invoke("ProcessOneWeatherFileAsIntervals", path, 2, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2001, 1, 1, 11, 0, 0));
+
+            Assert.AreEqual(0, retVal.Count);
+        }
+
+
+        [TestMethod]
+        public void ParseWeatherNull()
+        {
+            string path = "";
+            List<WeatherInstance> data = null;
+
+            Mock<IDataLoader> dl = new Mock<IDataLoader>();
+            dl.Setup(m => m.LoadWeatherFile(path)).Returns(data);
+
+            WeatherParser target = new WeatherParser(dl.Object);
+            PrivateObject obj = new PrivateObject(target);
+
+            List<WeatherInfo> retVal = (List<WeatherInfo>)obj.Invoke("ProcessOneWeatherFileAsIntervals", path, 2, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2001, 1, 1, 11, 0, 0));
+
+            Assert.AreEqual(0, retVal.Count);
+        }
 
         [TestMethod]
         public void ParseWeatherHourFiltering()
@@ -237,9 +290,6 @@ namespace ServerAppFunctionalTests.ParserTests
             WeatherParser target = new WeatherParser(dl.Object);
             PrivateObject obj = new PrivateObject(target);
 
-            List<ActivityInfo> jis = new List<ActivityInfo>();
-            List<ActivityInfo> pc = new List<ActivityInfo>();
-
             List<WeatherInfo> retVal = (List<WeatherInfo>)obj.Invoke("ProcessOneWeatherFileAsIntervals", path, 2, new DateTime(2000, 1, 1, 9, 0, 0), new DateTime(2000, 2, 1, 13, 0, 0));
 
             Assert.AreEqual(3, retVal.Count);
