public static TestTitleData VerifyTestTitleData()
        {
#if NET45 || NETCOREAPP2_0
            if (TestTitleData == null)
            {
                try
                {
                    var testTitleDataPath = Environment.GetEnvironmentVariable("PF_TEST_TITLE_DATA_JSON");
                    var jsonContent       = File.ReadAllText(testTitleDataPath + "/testTitleData.json");
                    TestTitleData = PlayFabSimpleJson.DeserializeObject <TestTitleData>(jsonContent);
                }
                catch (Exception)
                {
                }
            }
#endif
            // Fall back on hard coded testTitleData if necessary (Put your own data here)
            if (TestTitleData == null)
            {
                TestTitleData = new TestTitleData {
                    titleId = "6195", userEmail = "*****@*****.**"
                }
            }
            ;

            PlayFabSettings.staticSettings.TitleId = TestTitleData.titleId;

            return(TestTitleData);
        }
        public static void Start(bool postResultsToCloudscript = true, string filter = null, TestTitleData testInputs = null
#if !DISABLE_PLAYFABCLIENT_API
                                 , Action <PlayFabResult <ExecuteCloudScriptResult> > onComplete = null
#endif
                                 )
        {
            TestTitleData = testInputs;
            VerifyTestTitleData();

#if !DISABLE_PLAYFABCLIENT_API
            PlayFabApiTest.SetTitleInfo(TestTitleData);
#endif
#if ENABLE_PLAYFABSERVER_API || ENABLE_PLAYFABADMIN_API
            PlayFabServerApiTest.SetTitleInfo(TestTitleData);
#endif

            SuiteFinished             = false;
            AllTestsPassed            = false;
            _postResultsToCloudscript = postResultsToCloudscript;
            _suite = new UUnitTestSuite();
            _suite.FindAndAddAllTestCases(typeof(UUnitTestCase), filter);
#if !DISABLE_PLAYFABCLIENT_API
            _onComplete = onComplete;
#endif
        }
 /// <summary>
 /// PlayFab Title cannot be created from SDK tests, so you must provide your titleId to run unit tests.
 /// (Also, we don't want lots of excess unused titles)
 /// </summary>
 public static void SetTitleInfo(TestTitleData testInputs)
 {
     aliasId                             = testInputs.aliasId;
     testTitleData                       = testInputs;
     instanceSettings.TitleId            = testTitleData.titleId;
     instanceSettings.DeveloperSecretKey = testTitleData.developerSecretKey;
 }
        public static void Start(bool postResultsToCloudscript = true, string filter = null, TestTitleData testInputs = null
#if !DISABLE_PLAYFABCLIENT_API
                                 , Action <PlayFabResult <ExecuteCloudScriptResult> > onComplete = null
#endif
                                 )
        {
            // Fall back on hard coded testTitleData if necessary (Put your own data here)
            if (testInputs == null)
            {
                testInputs = new TestTitleData {
                    titleId = "6195", userEmail = "*****@*****.**"
                }
            }
            ;
#if !DISABLE_PLAYFABCLIENT_API
            PlayFabApiTest.SetTitleInfo(testInputs);
#endif

            SuiteFinished             = false;
            AllTestsPassed            = false;
            _postResultsToCloudscript = postResultsToCloudscript;
            _suite = new UUnitTestSuite();
            _suite.FindAndAddAllTestCases(typeof(UUnitTestCase), filter);
#if !DISABLE_PLAYFABCLIENT_API
            _onComplete = onComplete;
#endif
        }
Exemplo n.º 5
0
 /// <summary>
 /// PlayFab Title cannot be created from SDK tests, so you must provide your titleId to run unit tests.
 /// (Also, we don't want lots of excess unused titles)
 /// </summary>
 public static void SetTitleInfo(TestTitleData testInputs)
 {
     TITLE_INFO_SET = true;
     testTitleData  = testInputs;
     // Verify all the inputs won't cause crashes in the tests
     TITLE_INFO_SET &= !string.IsNullOrEmpty(PlayFabSettings.staticSettings.TitleId) &&
                       !string.IsNullOrEmpty(testTitleData.userEmail);
 }
Exemplo n.º 6
0
        public static TestTitleData LoadTestTitleData(string testTitleDataContents = null, bool setPlayFabSettings = true)
        {
            SetTitleId(setPlayFabSettings);

            if (_loadedData != null)
            {
                return(_loadedData);
            }

            if (!string.IsNullOrEmpty(testTitleDataContents))
            {
                _loadedData = LoadTitleDataWithPlugin(testTitleDataContents);
            }

            if (_loadedData == null)
            {
                var textAsset = Resources.Load <TextAsset>(Path.GetFileNameWithoutExtension(TestTitleDataDefaultFilename));
                if (textAsset != null)
                {
                    _loadedData = LoadTitleDataWithPlugin(textAsset.text);
                }
            }

            if (_loadedData == null)
            {
                var filename = TestTitleDataDefaultFilename;

#if UNITY_STANDALONE_WIN
                // Prefer to load path from environment variable, if present
                var tempFilename = Environment.GetEnvironmentVariable("PF_TEST_TITLE_DATA_JSON");
                if (!string.IsNullOrEmpty(tempFilename))
                {
                    filename = tempFilename;
                }
#endif
                if (File.Exists(filename))
                {
                    testTitleDataContents = PlayFabUtil.ReadAllFileText(filename);
                }

                _loadedData = LoadTitleDataWithPlugin(testTitleDataContents);
            }

            if (_loadedData == null)
            {
                // NOTE FOR DEVELOPERS: POPULATE THIS SECTION WITH REAL INFORMATION (or set up a testTitleData file, and set your PF_TEST_TITLE_DATA_JSON to the path for that file)
                _loadedData = new TestTitleData
                {
                    titleId   = "your title id here",
                    userEmail = "*****@*****.**"
                };
            }

            SetTitleId(setPlayFabSettings);
            return(_loadedData);
        }
Exemplo n.º 7
0
        /// <summary>
        /// PlayFab Title cannot be created from SDK tests, so you must provide your titleId to run unit tests.
        /// (Also, we don't want lots of excess unused titles)
        /// </summary>
        public static void SetTitleInfo(TestTitleData testInputs)
        {
            TITLE_INFO_SET = true;

            PlayFabSettings.TitleId = testInputs.titleId;
            USER_EMAIL = testInputs.userEmail;

            // Verify all the inputs won't cause crashes in the tests
            TITLE_INFO_SET &= !string.IsNullOrEmpty(PlayFabSettings.TitleId) &&
                              !string.IsNullOrEmpty(USER_EMAIL);
        }
        public static TestTitleData LoadTestTitleData(string testTitleDataContents = null, bool setPlayFabSettings = true)
        {
            SetTitleId(setPlayFabSettings);

            if (_loadedData != null)
            {
                return(_loadedData);
            }

            if (testTitleDataContents == null)
            {
                var filename = TestTitleDataDefaultFilename;

#if UNITY_STANDALONE_WIN
                // Prefer to load path from environment variable, if present
                var tempFilename = Environment.GetEnvironmentVariable("PF_TEST_TITLE_DATA_JSON");
                if (!string.IsNullOrEmpty(tempFilename))
                {
                    filename = tempFilename;
                }
#endif
                if (File.Exists(filename))
                {
                    testTitleDataContents = PlayFabUtil.ReadAllFileText(filename);
                }
            }

            if (!string.IsNullOrEmpty(testTitleDataContents))
            {
                _loadedData = PluginManager.GetPlugin <ISerializerPlugin>(PluginContract.PlayFab_Serializer).DeserializeObject <TestTitleData>(testTitleDataContents);
            }
            else
            {
                // NOTE FOR DEVELOPERS: POPULATE THIS SECTION WITH REAL INFORMATION (or set up a testTitleData file, and set your PF_TEST_TITLE_DATA_JSON to the path for that file)
                _loadedData = new TestTitleData
                {
                    titleId   = "your title id here",
                    userEmail = "*****@*****.**"
                };
            }

            SetTitleId(setPlayFabSettings);
            return(_loadedData);
        }
Exemplo n.º 9
0
        public static TestTitleData LoadTestTitleData(bool setPlayFabSettings = true)
        {
            if (_loadedData != null)
            {
                return(_loadedData);
            }

            var filename = TestTitleDataDefaultFilename;

#if UNITY_STANDALONE_WIN
            // Prefer to load path from environment variable, if present
            var tempFilename = Environment.GetEnvironmentVariable("PF_TEST_TITLE_DATA_JSON");
            if (!string.IsNullOrEmpty(tempFilename))
            {
                filename = tempFilename;
            }
#endif

            if (File.Exists(filename))
            {
                var testInputsFile = PlayFabUtil.ReadAllFileText(filename);

                _loadedData = JsonWrapper.DeserializeObject <TestTitleData>(testInputsFile);
            }
            else
            {
                // NOTE FOR DEVELOPERS: POPULATE THIS SECTION WITH REAL INFORMATION (or set up a testTitleData file, and set your PF_TEST_TITLE_DATA_JSON to the path for that file)
                _loadedData = new TestTitleData
                {
                    titleId   = "your title id here",
                    userEmail = "*****@*****.**"
                };
            }

            if (setPlayFabSettings)
            {
                PlayFabSettings.TitleId = _loadedData.titleId;
#if ENABLE_PLAYFABSERVER_API || ENABLE_PLAYFABADMIN_API
                PlayFabSettings.DeveloperSecretKey = _loadedData.developerSecretKey;
#endif
            }

            return(_loadedData);
        }
Exemplo n.º 10
0
        /// <summary>
        /// PlayFab Title cannot be created from SDK tests, so you must provide your titleId to run unit tests.
        /// (Also, we don't want lots of excess unused titles)
        /// </summary>
        public static void SetTitleInfo(TestTitleData testInputs)
        {
            TITLE_INFO_SET = true;

            // Parse all the inputs
            PlayFabDefaultSettings.TitleId            = testInputs.titleId;
            PlayFabDefaultSettings.DeveloperSecretKey = testInputs.developerSecretKey;
            USER_EMAIL = testInputs.userEmail;
            CHAR_NAME  = testInputs.characterName;

            // Verify all the inputs won't cause crashes in the tests
            TITLE_INFO_SET &= !string.IsNullOrEmpty(PlayFabDefaultSettings.TitleId) &&
                              !string.IsNullOrEmpty(PlayFabDefaultSettings.DeveloperSecretKey) &&
                              !string.IsNullOrEmpty(USER_EMAIL) &&
                              !string.IsNullOrEmpty(CHAR_NAME);

            Client = new PlayFabClientAPI();
            Server = new PlayFabServerAPI();
        }
Exemplo n.º 11
0
 /// <summary>
 /// PlayFab Title cannot be created from SDK tests, so you must provide your titleId to run unit tests.
 /// (Also, we don't want lots of excess unused titles)
 /// </summary>
 public static void SetTitleInfo(TestTitleData testInputs)
 {
     testTitleData = testInputs;
 }
 /// <summary>
 /// Receive the TestTitleData - We have got to find a better way to do this
 /// </summary>
 public static void SetTitleInfo(TestTitleData testInputs)
 {
     testTitleData = testInputs;
     PlayFabSettings.staticSettings.TitleId = testInputs.titleId;
 }
 /// <summary>
 /// PlayFab Title cannot be created from SDK tests, so you must provide your titleId to run unit tests.
 /// (Also, we don't want lots of excess unused titles)
 /// </summary>
 public static void SetTitleInfo(TestTitleData testInputs)
 {
     TITLE_INFO_SET = true;
     testTitleData  = testInputs;
 }