Exemple #1
0
        public void QuickSortInteger_Fail_LessWordsThanNumbers()
        {
            //Arrange
            var        _uadService = new UADService();
            bool       expected    = true;
            bool       actual      = false;
            List <int> numList     = new List <int> {
                5, 4, 3, 2, 1
            };
            List <string> wordList = new List <string> {
                "E", "D", "C", "B"
            };

            //Act
            try
            {
                sortServicer.QuickSortInteger(numList, wordList, 0, wordList.Count - 1);
                if (wordList[0].Equals("A") == true && wordList[1].Equals("B") == true && wordList[2].Equals("C") == true && wordList[3].Equals("D") == true && wordList[4].Equals("E") == true)
                {
                    actual = true;
                }
            }
            catch (Exception all)
            {
                actual = true;
            }

            Assert.AreNotEqual(actual, expected);
        }
Exemple #2
0
        public void QuickSortDouble_Pass()
        {
            // Arrange
            var           _uadService = new UADService();
            bool          expected    = true;
            bool          actual      = false;
            List <double> numList     = new List <double> {
                5.5, 4.4, 3.3, 2.2, 1.1
            };
            List <string> wordList = new List <string> {
                "E", "D", "C", "B", "A"
            };

            // Act
            sortServicer.QuickSortDouble(numList, wordList);
            for (int i = 0; i < numList.Count; i++)
            {
                Console.WriteLine(numList[i]);
                Console.WriteLine(wordList[i]);
            }
            if ((numList[0] == 1.1 && wordList[0].Equals("A")) && (numList[1] == 2.2 && wordList[1].Equals("B")) && (numList[2] == 3.3 && wordList[2].Equals("C")) && (numList[3] == 4.4 && wordList[3].Equals("D")) && (numList[4] == 5.5 && wordList[4].Equals("E")))
            {
                actual = true;
            }
            Assert.AreEqual(actual, expected);
        }
Exemple #3
0
        public void QuickSortInteger_Pass_DuplicateNumbers()
        {
            // Arrange
            var        _uadService = new UADService();
            bool       expected    = true;
            bool       actual      = false;
            List <int> numList     = new List <int> {
                2, 3, 5, 3, 1
            };
            List <string> wordList = new List <string> {
                "E", "D", "C", "B", "A"
            };

            // Act
            sortServicer.QuickSortInteger(numList, wordList, 0, wordList.Count - 1);
            if ((numList[0] == 1 && wordList[0].Equals("A")) && (numList[1] == 2 && wordList[1].Equals("E")) && (numList[2] == 3 && wordList[2].Equals("B")) && (numList[3] == 3 && wordList[3].Equals("D")) && (numList[4] == 5 && wordList[4].Equals("C")))
            {
                actual = true;
            }
            Assert.AreEqual(actual, expected);
        }
Exemple #4
0
        public void GetEntryLogswithURL_Pass_URLNotLogged()
        {
            //Arrange
            IUADService   _uadService    = new UADService();
            LoggerService _loggerService = new LoggerService();
            string        entryLog       = "https://www.test.com";
            bool          expected       = true;
            bool          actual         = false;
            string        path           = "C:\\Users\\Midnightdrop\\Documents\\GitHub\\GreetNGroup\\Backend\\UnitTest\\UADTest\\TestLogs\\ServiceLogs\\PassLogs";
            List <GNGLog> logList        = new List <GNGLog>();

            //Act
            logList = _loggerService.ReadLogsPath(path);
            var newLog = _uadService.GetEntryLogswithURL(logList, entryLog);

            if (newLog.Count == 0)
            {
                actual = true;
            }
            // Assert
            Assert.AreEqual(actual, expected);
        }
Exemple #5
0
        public void GetLogswithID_Pass()
        {
            // Arrange
            IUADService   _uadService    = new UADService();
            LoggerService _loggerService = new LoggerService();
            bool          expected       = true;
            bool          actual         = false;
            string        logID          = "ClickEvent";

            // Read testlogs from this path
            string        path    = "C:\\Users\\Midnightdrop\\Documents\\GitHub\\GreetNGroup\\Backend\\UnitTest\\UADTest\\TestLogs\\ServiceLogs\\PassLogs";
            List <GNGLog> logList = new List <GNGLog>();

            // Act
            logList = _loggerService.ReadLogsPath(path);
            logList = _uadService.GetLogswithID(logList, logID);
            if (logList.Count == 4)
            {
                actual = true;
            }

            Assert.AreEqual(actual, expected);
        }
Exemple #6
0
 public UADManager()
 {
     uADService = new UADService();
 }