public async Task CanLaunch() { var launcher = A.Fake <IRealVirtualityLauncher>(); A.CallTo(() => launcher.Launch(A <LaunchGameInfo> ._)) .ReturnsLazily(() => Task.FromResult(Process.GetCurrentProcess())); await _game.Launch(GameTest.GameLauncher(_game, launcher)).ConfigureAwait(false); }
public async Task CanLaunchWithResetGameKeyEachLaunch_LaunchesJustOnce() { _settings.ResetGameKeyEachLaunch = true; _settings.LaunchUsingSteam = true; var launcher = A.Fake <IRealVirtualityLauncher>(); var specs = new List <LaunchGameInfoBase>(); A.CallTo(() => launcher.Launch(A <LaunchGameWithSteamLegacyInfo> ._)) .Invokes((IAsyncRequest <Process> x) => specs.Add((LaunchGameInfoBase)x)) .ReturnsLazily(() => Task.FromResult(Process.GetCurrentProcess())); await _game.Launch(GameTest.GameLauncher(_game, launcher)).ConfigureAwait(false); specs.Should().HaveCount(1); specs[0].StartupParameters.Should() .BeEmpty(); }
public async Task CanLaunchWithResetGameKeyEachLaunch() { _settings.ResetGameKeyEachLaunch = true; var parPath = Path.Combine(Path.GetTempPath(), _game.Id + ".txt").ToAbsoluteFilePath(); var launcher = A.Fake <IRealVirtualityLauncher>(); var specs = new List <LaunchGameInfoBase>(); A.CallTo(() => launcher.Launch(A <LaunchGameInfo> ._)) .Invokes((IAsyncRequest <Process> x) => specs.Add((LaunchGameInfo)x)) .ReturnsLazily(() => Task.FromResult(Process.GetCurrentProcess())); A.CallTo(() => launcher.WriteParFile(A <WriteParFileInfo> .That.Matches(x => x.GameId == _game.Id))) .ReturnsLazily(() => Task.FromResult(parPath)); await _game.Launch(GameTest.GameLauncher(_game, launcher)).ConfigureAwait(false); specs.Should().HaveCount(2); specs[0].StartupParameters.Should().BeEquivalentTo(new[] { "-doNothing" }); specs[0].Should().BeOfType <LaunchGameWithSteamLegacyInfo>(); specs[1].StartupParameters.Should() .BeEquivalentTo(new[] { "-par=" + parPath, "-nosplash", "-nofilepatching" }); specs[1].Should().BeOfType <LaunchGameWithSteamInfo>(); }