예제 #1
0
        private static int Main(string[] args)
        {
            StartedMessage();
            int result = 1;

            if (ArgumentsValidator.Validate(args) && MemoryValidator.ValidateMemory(_blockSize, _borderCapacity, _countProccessingThread))
            {
                using (var archiver = AbstractArchiver.CreateArchiver(args[0], args[1], args[2], _blockSize, _borderCapacity, _countProccessingThread))
                {
                    if (archiver.Start())
                    {
                        FinishMessage("Success");
                        result = 0;
                    }
                    else
                    {
                        ClearData(args[2]);
                        FinishMessage("Failure");
                    }
                }
            }
            Console.WriteLine(" Push any key to continue..");
            Console.ReadKey();
            return(result);
        }
예제 #2
0
        public void ValidateMemory_SetBorderCapacityAndBlockSize_ReturnTrue()
        {
            //arrange
            int blockSize      = 1024 * 1024;
            int borderCapacity = 1;
            //act
            var result = MemoryValidator.ValidateMemory(blockSize, ref borderCapacity);

            //assert
            Assert.IsTrue(result);
        }
예제 #3
0
        public void SetAvailableBorderCapacity_SetMaximumFreeRam_borderCapacity()
        {
            int  fullBlockSize  = 1024 * 1024 + 16;
            long freeRam        = 68719476736;
            int  borderCapacity = 10;
            //calculate neededram = 250
            long neededRam = MemoryValidator.CalculateMinimumNeededRam(fullBlockSize, borderCapacity);
            var  result    = MemoryValidator.SetAvailableBorderCapacity(freeRam, fullBlockSize, neededRam, borderCapacity);

            //border changes
            Assert.IsTrue(result > borderCapacity);
        }
예제 #4
0
        public void SetAvailableBorderCapacity_SetSmallFreeRam_DefaultBorderCapacity()
        {
            int  fullBlockSize  = 10;
            long freeRam        = 350;
            int  borderCapacity = 10;
            //calculate neededram = 250
            long neededRam = MemoryValidator.CalculateMinimumNeededRam(fullBlockSize, borderCapacity);
            var  result    = MemoryValidator.SetAvailableBorderCapacity(freeRam, fullBlockSize, neededRam, borderCapacity);

            //border changes
            Assert.IsTrue(result == borderCapacity);
        }