public void WhenTranslatingRelativeBytePosition_ByteAtEndOfFile_CurrentBytePositionReturned()
        {
            // Setup test objects
            LogViewModel testLogViewModel = new LogViewModel();

            List <Tuple <string, long> > testLogFileLocations = new List <Tuple <string, long> >
            {
                new Tuple <string, long>("log1", 102),
                new Tuple <string, long>("log2", 222),
                new Tuple <string, long>("log3", 442),
                new Tuple <string, long>("log4", 662),
                new Tuple <string, long>("log5", 882)
            };

            testLogViewModel.CreateLogFiles(testLogFileLocations);
            long relativeByte = 323;

            // Perform test

            long specificByte = testLogViewModel.TranslateRelativeBytePosition(relativeByte);

            // Check test result
            long expectedByte = 221;

            Assert.AreEqual(expectedByte, specificByte);
        }
        public void WhenLocatingLogFileFromByteReference_ByteAboveTotalBytes_ReturnLastFile()
        {
            // Setup test objects
            LogViewModel testLogViewModel = new LogViewModel();

            List <Tuple <string, long> > testLogFileLocations = new List <Tuple <string, long> >
            {
                new Tuple <string, long>("log1", 100),
                new Tuple <string, long>("log2", 220),
                new Tuple <string, long>("log3", 440),
                new Tuple <string, long>("log4", 660),
                new Tuple <string, long>("log5", 880)
            };

            testLogViewModel.CreateLogFiles(testLogFileLocations);
            long relativeByte = 6600;

            // Perform test
            string logFileFromByteReference = testLogViewModel.LocateLogFileFromByteReference(relativeByte);

            // Check test result
            string expectedLogFile = "log5";

            Assert.AreEqual(expectedLogFile, logFileFromByteReference);
        }
        public void WhenCreatingRelativeByteReference_ByteBeneathZero_ReturnCorrectFile()
        {
            // Setup test objects
            LogViewModel testLogViewModel = new LogViewModel();

            List <Tuple <string, long> > testLogFileLocations = new List <Tuple <string, long> >
            {
                new Tuple <string, long>("log1", 100),
                new Tuple <string, long>("log2", 220),
                new Tuple <string, long>("log3", 440),
                new Tuple <string, long>("log4", 660),
                new Tuple <string, long>("log5", 880)
            };

            testLogViewModel.CreateLogFiles(testLogFileLocations);

            long   byteWithinFile = -455;
            string logFileName    = "log3";

            // Perform test
            long relativeByteReference = testLogViewModel.CreateRelativeByteReference(byteWithinFile, logFileName);

            // Check test result
            long expectedByteReference = 320;

            Assert.AreEqual(expectedByteReference, relativeByteReference);
        }
        public void WhenTranslatingRelativeBytePosition_ByteBeneathZero_ReturnZeroValue()
        {
            // Setup test objects
            LogViewModel testLogViewModel = new LogViewModel();

            List <Tuple <string, long> > testLogFileLocations = new List <Tuple <string, long> >
            {
                new Tuple <string, long>("log1", 100),
                new Tuple <string, long>("log2", 220),
                new Tuple <string, long>("log3", 440),
                new Tuple <string, long>("log4", 660),
                new Tuple <string, long>("log5", 880)
            };

            testLogViewModel.CreateLogFiles(testLogFileLocations);
            long relativeByte = -2666;

            // Perform test

            long specificByte = testLogViewModel.TranslateRelativeBytePosition(relativeByte);

            // Check test result
            long expectedByte = 0;

            Assert.AreEqual(expectedByte, specificByte);
        }