Example #1
0
        public void CreateLaunchWarningMessages(GameletSdkCompatibilityResult?sdkResult,
                                                string sdkWarning, string[] parserWarnings)
        {
            SetupSdkCompatibility(sdkResult);
            var launchRequest = new LaunchGameRequest();

            SetupParamsParser(launchRequest, GetStatus(parserWarnings, false));
            var launchGameResponse = new LaunchGameResponse
            {
                GameLaunchName = _gameLaunchName, RequestId = launchRequest.RequestId
            };

            SetupGameLaunchApi(launchRequest, launchGameResponse);
            SetupSdkWarningSetting();

            IVsiGameLaunch result = _target.CreateLaunch(_launchParams);

            Assert.That(result, Is.Not.Null);
            _dialogUtil.DidNotReceiveWithAnyArgs().ShowError(Arg.Any <string>(), Arg.Any <string>());

            if (string.IsNullOrEmpty(sdkWarning))
            {
                _dialogUtil.DidNotReceive()
                .ShowOkNoMoreDisplayWarning(sdkWarning, Arg.Any <string[]>());
            }
            else
            {
                _dialogUtil.Received(1).ShowOkNoMoreDisplayWarning(sdkWarning, Arg.Any <string[]>());
            }

            if (parserWarnings.Any())
            {
                _dialogUtil.Received(1)
                .ShowWarning(Arg.Is <string>(m => parserWarnings.All(m.Contains)));
            }

            Assert.That(_devEvent.GameLaunchData.RequestId, Is.EqualTo(launchRequest.RequestId));
            Assert.That(_devEvent.GameLaunchData.LaunchId, Is.EqualTo(_gameLaunchId));
            Assert.That(_devEvent.GameLaunchData.EndReason, Is.Null);
            _action.Received(1).Record(Arg.Any <Func <bool> >());
        }