Example #1
0
        public IEnumerator TestSendEvent_WithStringData_ReturnsError()
        {
            var    userAccount      = AccelBytePlugin.GetUser();
            Result emailLoginResult = null;

            Result <RegisterUserResponse> registerResult = null;
            var user = AccelBytePlugin.GetUser();

            user.Register(
                "*****@*****.**",
                "Password123",
                "testeraccelbyte",
                "US",
                DateTime.Now.AddYears(-22),
                result => registerResult = result);

            while (registerResult == null)
            {
                Thread.Sleep(100);

                yield return(null);
            }

            userAccount.LoginWithUsername(
                "*****@*****.**",
                "Password123",
                result => { emailLoginResult = result; });

            while (emailLoginResult == null)
            {
                Thread.Sleep(100);

                yield return(null);
            }

            TestHelper.Assert.That(!emailLoginResult.IsError);

            var    telemetry       = AccelBytePlugin.GetTelemetry();
            Result telemetryResult = null;

            telemetry.SendEvent(new TelemetryEventTag(), "string data", result => { telemetryResult = result; });

            while (telemetryResult == null)
            {
                Thread.Sleep(100);

                yield return(null);
            }


            Result deleteResult = null;
            var    helper       = new TestHelper();

            helper.DeleteUser(userAccount, result => deleteResult = result);

            while (deleteResult == null)
            {
                Thread.Sleep(100);

                yield return(null);
            }

            Result logoutResult = null;

            userAccount.Logout(r => logoutResult = r);

            while (logoutResult == null)
            {
                Thread.Sleep(100);

                yield return(null);
            }

            TestHelper.Assert.That(telemetryResult.IsError);
            TestHelper.Assert.That(deleteResult.IsError, Is.False);
            TestHelper.Assert.That(logoutResult.IsError, Is.False);
        }