Пример #1
0
        public void EnumPorts()
        {
            var gamelets = new List <Gamelet>
            {
                new Gamelet {
                    Id = "test id1", DisplayName = "name1", ReserverEmail = _reserver
                },
                new Gamelet
                {
                    Id            = "test id2", DisplayName = "name2",
                    ReserverEmail = "*****@*****.**"
                },
                new Gamelet {
                    Id = "test id3", DisplayName = "name3", ReserverEmail = _reserver
                },
            };

            _gameletClient.ListGameletsAsync(onlyOwned: false)
            .Returns(x => Task.FromResult(gamelets));

            var ownedInstancePort1 = Substitute.For <IDebugPort2>();

            _debugPortFactory.Create(gamelets[0], _portSupplier, _testDebugSessionId)
            .Returns(ownedInstancePort1);

            var projectInstancePort = Substitute.For <IDebugPort2>();

            _debugPortFactory.Create(gamelets[1], _portSupplier, _testDebugSessionId)
            .Returns(projectInstancePort);

            var ownedInstancePort2 = Substitute.For <IDebugPort2>();

            _debugPortFactory.Create(gamelets[2], _portSupplier, _testDebugSessionId)
            .Returns(ownedInstancePort2);

            Assert.AreEqual(VSConstants.S_OK,
                            _portSupplier.EnumPorts(out IEnumDebugPorts2 portsEnum));

            var  ports      = new IDebugPort2[3];
            uint numFetched = 0;

            Assert.AreEqual(VSConstants.S_OK,
                            portsEnum.Next((uint)ports.Length, ports, ref numFetched));
            CollectionAssert.AreEqual(
                new[] { projectInstancePort, ownedInstancePort2, ownedInstancePort1 }, ports);

            AssertMetricRecorded(DeveloperEventType.Types.Type.VsiGameletsList,
                                 DeveloperEventStatus.Types.Code.Success);
        }
Пример #2
0
        public async Task LaunchNoDebugLegacyFlowAsync([Values(false, true)] bool renderdoc,
                                                       [Values(false, true)] bool rgp,
                                                       [Values(null, "optprintasserts")]
                                                       string vulkanDriverVariant)
        {
            _project.GetLaunchRenderDocAsync().Returns(renderdoc);
            _project.GetLaunchRgpAsync().Returns(rgp);
            _project.GetVulkanDriverVariantAsync().Returns(vulkanDriverVariant);

            var gamelets = new List <Gamelet>
            {
                new Gamelet
                {
                    Id     = _testGameletId,
                    Name   = _testGameletName,
                    IpAddr = _testGameletIp,
                    State  = GameletState.Reserved,
                }
            };

            _gameletClient.ListGameletsAsync().Returns(Task.FromResult(gamelets));

            _gameletSelector.TrySelectAndPrepareGamelet(Arg.Any <string>(),
                                                        Arg.Any <DeployOnLaunchSetting>(), gamelets,
                                                        Arg.Any <TestAccount>(), Arg.Any <string>(),
                                                        out Gamelet _).Returns(x =>
            {
                x[_outVariableIndex] = gamelets[0];
                return(true);
            });

            var launchSettings = await QueryDebugTargetsAsync(DebugLaunchOptions.NoDebug);

            Assert.AreEqual(1, launchSettings.Count);
            Assert.AreEqual(DebugLaunchOptions.NoDebug | DebugLaunchOptions.MergeEnvironment,
                            launchSettings[0].LaunchOptions);
            Assert.AreEqual(_testProjectDir, launchSettings[0].CurrentDirectory);
            Assert.AreEqual(Environment.SystemDirectory + "\\cmd.exe",
                            launchSettings[0].Executable);

            _launchCommandFormatter.Parse(launchSettings[0].Arguments,
                                          out LaunchParams launchParams, out _);
            Assert.AreEqual(await _project.GetTargetFileNameAsync(), launchParams.Cmd);
            Assert.AreEqual(renderdoc, launchParams.RenderDoc);
            Assert.AreEqual(rgp, launchParams.Rgp);
            Assert.AreEqual(_testApplicationName, launchParams.ApplicationName);
            Assert.AreEqual(_testGameletName, launchParams.GameletName);
            Assert.AreEqual(_testAccount, launchParams.Account);
            Assert.IsFalse(launchParams.Debug);
            Assert.AreEqual(_sdkVersionString, launchParams.SdkVersion);
            Assert.AreEqual(launchParams.VulkanDriverVariant, vulkanDriverVariant);
            Assert.AreEqual(launchParams.QueryParams, _customQueryParams);

            await _remoteDeploy.Received().DeployGameExecutableAsync(
                _project, new SshTarget(gamelets[0]), Arg.Any <ICancelable>(), Arg.Any <IAction>());

            AssertMetricRecorded(DeveloperEventType.Types.Type.VsiDebugSetupQueries,
                                 DeveloperEventStatus.Types.Code.Success);
            AssertMetricRecorded(DeveloperEventType.Types.Type.VsiDeployBinary,
                                 DeveloperEventStatus.Types.Code.Success);
        }