public static void Initialize(TestContext testContext) { IWorkerFactory <IWorker> workerFactory = new LocalWorkerFactory(); _testedPool = FreezerGlobal.Workers; _httpServer = new StaticHttpServer(FreezerTestPathSolver.GetDirectory("WebPages")); }
public void DownloadReleasesFromHttpServerIntegrationTest() { string tempDir = null; var updateDir = new DirectoryInfo(IntegrationTestHelper.GetPath("..", "SampleUpdatingApp", "SampleReleasesFolder")); IDisposable disp; try { var httpServer = new StaticHttpServer(30405, updateDir.FullName); disp = httpServer.Start(); } catch (HttpListenerException) { Assert.False(true, @"Windows sucks, go run 'netsh http add urlacl url=http://+:30405/ user=MYMACHINE\MyUser"); return; } var entriesToDownload = updateDir.GetFiles("*.nupkg") .Select(x => ReleaseEntry.GenerateFromFile(x.FullName)) .ToArray(); entriesToDownload.Count().ShouldBeGreaterThan(0); using (disp) using (Utility.WithTempDirectory(out tempDir)) { // NB: This is normally done by CheckForUpdates, but since // we're skipping that in the test we have to do it ourselves Directory.CreateDirectory(Path.Combine(tempDir, "SampleUpdatingApp", "packages")); var fixture = new UpdateManager("http://localhost:30405", "SampleUpdatingApp", FrameworkVersion.Net40, tempDir); using (fixture) { var progress = new ReplaySubject <int>(); fixture.DownloadReleases(entriesToDownload, progress).First(); this.Log().Info("Progress: [{0}]", String.Join(",", progress)); progress.Buffer(2, 1).All(x => x.Count != 2 || x[1] > x[0]).First().ShouldBeTrue(); progress.Last().ShouldEqual(100); } entriesToDownload.ForEach(x => { this.Log().Info("Looking for {0}", x.Filename); var actualFile = Path.Combine(tempDir, "SampleUpdatingApp", "packages", x.Filename); File.Exists(actualFile).ShouldBeTrue(); var actualEntry = ReleaseEntry.GenerateFromFile(actualFile); actualEntry.SHA1.ShouldEqual(x.SHA1); actualEntry.Version.ShouldEqual(x.Version); }); } }
//[TestMethod] public void TestRenderOnFreezerJsEventWithSingleWebPageHard() { var rootDirectoryPath = FreezerTestPathSolver.GetDirectory("WebPages"); var hostname = "127.0.0.1"; int port = 25345; // This port is hardcoded. Can be changed if busy using (new ExclusiveBlock("TestRenderOnFreezerJsEventWithSingleWebPageHard")) { RunnerCore.SetupHostAsync(hostname, port, null, "TestRenderOnFreezerJsEventWithSingleWebPageHard"); using (var httpListener = new StaticHttpServer(rootDirectoryPath)) { var url = $"{_httpServer.BoundURL}/Global/verylongpage.html"; //var url = "http://dragonball.wikia.com/wiki/Frieza"; var hostableLocalProcess = new CaptureHostMock() { Hostname = hostname, Port = port }; var trigger = new WindowLoadTrigger(); // new FreezerJsEventTrigger(); var zone = CaptureZone.FullPage; using (IWorker runnerHost = new RemoteWorker(hostableLocalProcess)) { var remoteTask = new RemoteTask() { BrowserSize = new Size(800, 600), Url = url, }; remoteTask.SetTrigger(trigger); remoteTask.SetCaptureZone(zone); var taskResult = runnerHost.PerformTask(remoteTask); File.WriteAllBytes($@"BmpResults/out-{nameof(TestRenderOnFreezerJsEventWithSingleWebPageHard)}.png", taskResult.PayLoad); } } } }
public void DownloadReleasesFromHttpServerIntegrationTest() { string tempDir = null; var updateDir = new DirectoryInfo(IntegrationTestHelper.GetPath("..", "SampleUpdatingApp", "SampleReleasesFolder")); IDisposable disp; try { var httpServer = new StaticHttpServer(30405, updateDir.FullName); disp = httpServer.Start(); } catch (HttpListenerException) { Assert.False(true, @"Windows sucks, go run 'netsh http add urlacl url=http://+:30405/ user=MYMACHINE\MyUser"); return; } var entriesToDownload = updateDir.GetFiles("*.nupkg") .Select(x => ReleaseEntry.GenerateFromFile(x.FullName)) .ToArray(); entriesToDownload.Count().ShouldBeGreaterThan(0); using (disp) using (Utility.WithTempDirectory(out tempDir)) { // NB: This is normally done by CheckForUpdates, but since // we're skipping that in the test we have to do it ourselves Directory.CreateDirectory(Path.Combine(tempDir, "SampleUpdatingApp", "packages")); var fixture = new UpdateManager("http://localhost:30405", "SampleUpdatingApp", FrameworkVersion.Net40, tempDir); using (fixture) { var progress = new ReplaySubject<int>(); fixture.DownloadReleases(entriesToDownload, progress).First(); this.Log().Info("Progress: [{0}]", String.Join(",", progress)); progress.Buffer(2,1).All(x => x.Count != 2 || x[1] > x[0]).First().ShouldBeTrue(); progress.Last().ShouldEqual(100); } entriesToDownload.ForEach(x => { this.Log().Info("Looking for {0}", x.Filename); var actualFile = Path.Combine(tempDir, "SampleUpdatingApp", "packages", x.Filename); File.Exists(actualFile).ShouldBeTrue(); var actualEntry = ReleaseEntry.GenerateFromFile(actualFile); actualEntry.SHA1.ShouldEqual(x.SHA1); actualEntry.Version.ShouldEqual(x.Version); }); } }
public void DownloadReleasesFromHttpServerIntegrationTest() { string tempDir = null; var updateDir = new DirectoryInfo(IntegrationTestHelper.GetPath("..", "SampleUpdatingApp", "SampleReleasesFolder")); var httpServer = new StaticHttpServer(30405, updateDir.FullName); var entriesToDownload = updateDir.GetFiles("*.nupkg") .Select(x => ReleaseEntry.GenerateFromFile(x.FullName)) .ToArray(); entriesToDownload.Count().ShouldBeGreaterThan(0); using (httpServer.Start()) using (Utility.WithTempDirectory(out tempDir)) { // NB: This is normally done by CheckForUpdates, but since // we're skipping that in the test we have to do it ourselves (new DirectoryInfo(Path.Combine(tempDir, "SampleUpdatingApp", "packages"))).CreateRecursive(); var fixture = new UpdateManager("http://localhost:30405", "SampleUpdatingApp", FrameworkVersion.Net40, tempDir); using (fixture.AcquireUpdateLock()) { var progress = fixture.DownloadReleases(entriesToDownload).ToList().First(); this.Log().Info("Progress: [{0}]", String.Join(",", progress)); progress.Buffer(2,1).All(x => x.Count != 2 || x[1] > x[0]).ShouldBeTrue(); progress.Last().ShouldEqual(100); } entriesToDownload.ForEach(x => { this.Log().Info("Looking for {0}", x.Filename); var actualFile = Path.Combine(tempDir, "SampleUpdatingApp", "packages", x.Filename); File.Exists(actualFile).ShouldBeTrue(); var actualEntry = ReleaseEntry.GenerateFromFile(actualFile); actualEntry.SHA1.ShouldEqual(x.SHA1); actualEntry.Version.ShouldEqual(x.Version); }); } }
public static void Initialize(TestContext testContext) { _httpServer = new StaticHttpServer(FreezerTestPathSolver.GetDirectory("WebPages")); }