public void CheckVersionContinuationDisagreementTest()
        {
            var NewFilePath = CreateFiles("TestNew", true);
            var OldFilePath = CreateFiles("TestOld");

            var model = new UpdateModel
            {
                UserParams = new UserParams
                {
                    IntepubDirectory = new DirectoryInfo(OldFilePath)
                },
                UnZipDirectory = new DirectoryInfo(NewFilePath)
            };

            var environmentManagerMock = new EnvironmentManagerMock();

            var result = new CheckVersionProcess(new ConfigurationBuilder()
                                                 .SetBasePath(Directory.GetCurrentDirectory())
                                                 .AddJsonFile("appsettings.json", optional: true).Build(), environmentManagerMock);


            result.ProcessEvent += ResultProcessEventMockNewerFile;
            result.ConfirmEvent += ResultConfirmEventContinuingCancellation;

            try
            {
                result.Process(model);
                Assert.True(environmentManagerMock.Counter > 0);
            }
            finally
            {
                Directory.Delete(NewFilePath, true);
                Directory.Delete(OldFilePath, true);
            }
        }
        public void CheckVersionFilesNotFound()
        {
            var DirectoryWithoutFilesPath = CreateFiles("old", havingNoFiles: true);

            var model = new UpdateModel
            {
                UserParams = new UserParams
                {
                    IntepubDirectory = new DirectoryInfo(DirectoryWithoutFilesPath)
                },
                UnZipDirectory = new DirectoryInfo(DirectoryWithoutFilesPath)
            };

            var result = new CheckVersionProcess(new ConfigurationBuilder()
                                                 .SetBasePath(Directory.GetCurrentDirectory())
                                                 .AddJsonFile("appsettings.json", optional: true).Build(), null);

            try
            {
                Assert.Throws <Exception>(() => result.Process(model));
            }
            finally
            {
                Directory.Delete(DirectoryWithoutFilesPath);
            }
        }
        public void CheckVersionNewerFileInOldApp()
        {
            var NewFilePath = CreateFiles("TestNew", true);
            var OldFilePath = CreateFiles("TestOld");


            var model = new UpdateModel
            {
                UserParams = new UserParams
                {
                    IntepubDirectory = new DirectoryInfo(OldFilePath)
                },
                UnZipDirectory = new DirectoryInfo(NewFilePath)
            };

            var result = new CheckVersionProcess(new ConfigurationBuilder()
                                                 .SetBasePath(Directory.GetCurrentDirectory())
                                                 .AddJsonFile("appsettings.json", optional: true).Build(), null);

            result.ProcessEvent += ResultProcessEventMockNewerFile;
            result.ConfirmEvent += ResultConfirmEventMockContinueConfirmation;

            try
            {
                result.Process(model);
            }
            finally
            {
                Directory.Delete(OldFilePath, true);
                Directory.Delete(NewFilePath, true);
            }
        }
        public void CheckVersionShowDifferencesTest()
        {
            var OldFilePath = CreateFiles("TestOld");
            var NewFilePath = CreateFiles("TestNew", true);

            var model = new UpdateModel
            {
                UserParams = new UserParams
                {
                    IntepubDirectory = new DirectoryInfo(OldFilePath)
                },
                UnZipDirectory = new DirectoryInfo(NewFilePath)
            };

            var result = new CheckVersionProcess(new ConfigurationBuilder()
                                                 .SetBasePath(Directory.GetCurrentDirectory())
                                                 .AddJsonFile("appsettings.json", optional: true).Build(), null).Process(model);

            try
            {
                Assert.Contains(Consts.ProcesEventResult.Successful, result.Result);
            }
            finally
            {
                Directory.Delete(OldFilePath, true);
                Directory.Delete(NewFilePath, true);
            }
        }
        public void CheckVersion(UpdateModel updateModel)
        {
            var process = new CheckVersionProcess(ConfigurationRoot, environmentManager);

            process.ProcessEvent += ProcessEvent;
            process.ConfirmEvent += ConfirmEvent;

            ResultEvetnt(process.Process(updateModel), null);
        }
        public void CheckVersionNullReferencePathTest()
        {
            var model = new UpdateModel
            {
                UserParams = new UserParams
                {
                    IntepubDirectory = null
                },
                UnZipDirectory = null
            };

            var result = new CheckVersionProcess(new ConfigurationBuilder()
                                                 .SetBasePath(Directory.GetCurrentDirectory())
                                                 .AddJsonFile("appsettings.json", optional: true).Build(), null);

            Assert.Throws <NullReferenceException>(() => result.Process(model));
        }
        public void CheckVersionDirectoryNotFoundTest()
        {
            var NotExsistingDirectorPath = CreateFiles("random", havingNoDirectory: true);
            //var newPath = CreateFiles("new", havingNoDirectory, true);

            var model = new UpdateModel
            {
                UserParams = new UserParams
                {
                    IntepubDirectory = new DirectoryInfo(NotExsistingDirectorPath)
                },
                UnZipDirectory = new DirectoryInfo(NotExsistingDirectorPath)
            };

            var result = new CheckVersionProcess(new ConfigurationBuilder()
                                                 .SetBasePath(Directory.GetCurrentDirectory())
                                                 .AddJsonFile("appsettings.json", optional: true).Build(), null);

            Assert.Throws <DirectoryNotFoundException>(() => result.Process(model));
        }