public IEnumerator EndPointUpdateRetry()
    {
        // 必ず失敗するURLを実行
        EndPointSelectorSettings.ENDPOINT_INFO_URL = "https://127.0.0.1/" + Guid.NewGuid().ToString("N");

        // Autoyaの起動と、起動直後にEndPointの更新、
        // Retryするかどうかのポイントをリトライが完了したかどうかの確認ポイントとして、一度実行されたら更新が発生するようにセットする
        // こうすることで、リトライの直後にURLが書き換わり、認証まで終わるのを待てばEpの更新が完了する。
        var dataPath = Application.persistentDataPath;

        Autoya.TestEntryPoint(dataPath);

        Autoya.Debug_OnEndPointInstanceRequired(
            () =>
        {
            return(new AutoyaFramework.EndPointSelect.IEndPoint[] { new main(), new sub() });
        }
            );

        var done = false;

        Autoya.Debug_SetShouldRetryEndPointGetRequest(
            () =>
        {
            done = true;
            return(true);
        }
            );

        while (!done)
        {
            yield return(null);
        }

        // change to valid url.
        EndPointSelectorSettings.ENDPOINT_INFO_URL = "https://raw.githubusercontent.com/sassembla/Autoya/master/Assets/AutoyaTests/RuntimeData/EndPoints/mainAndSub.json";
        while (!Autoya.Auth_IsAuthenticated())
        {
            yield return(null);
        }

        // epUpdate succeeded and updated.
        var mainEp = Autoya.EndPoint_GetEndPoint <main>();

        Assert.True(mainEp.key0 == "val0", "not match. mainEp.key0:" + mainEp.key0);
        Assert.True(mainEp.key1 == "default_val1", "not match. mainEp.key1:" + mainEp.key1);

        var subEp = Autoya.EndPoint_GetEndPoint <sub>();

        Assert.True(subEp.key0 == "default_val0", "not match. subEp.key0:" + subEp.key0);
    }
Exemplo n.º 2
0
    public IEnumerator EndPointUpdateSub()
    {
        EndPointSelectorSettings.ENDPOINT_INFO_URL = "https://raw.githubusercontent.com/sassembla/Autoya/master/Assets/AutoyaTests/RuntimeData/EndPoints/sub.json";

        var cor = Autoya.Debug_EndPointUpdate(new AutoyaFramework.EndPointSelect.IEndPoint[] { new main(), new sub() });

        while (cor.MoveNext())
        {
            yield return(null);
        }

        // epUpdate succeeded, main not updated and sub is updated.
        var mainEp = Autoya.EndPoint_GetEndPoint <main>();

        Assert.True(mainEp.key0 == "default_val0", "not match. mainEp.key0:" + mainEp.key0);
        Assert.True(mainEp.key1 == "default_val1", "not match. mainEp.key1:" + mainEp.key1);

        var subEp = Autoya.EndPoint_GetEndPoint <sub>();

        Assert.True(subEp.key0 == "default_val0", "not match. subEp.key0:" + subEp.key0);
    }
Exemplo n.º 3
0
    public IEnumerator EndPointUpdateWithEmptyInfo()
    {
        var cor = Autoya.Debug_EndPointUpdate(new AutoyaFramework.EndPointSelect.IEndPoint[] { new main(), new sub() });

        while (cor.MoveNext())
        {
            yield return(null);
        }

        EndPointSelectorSettings.ENDPOINT_INFO_URL = "https://raw.githubusercontent.com/sassembla/Autoya/master/Assets/AutoyaTests/RuntimeData/EndPoints/empty.json";

        // empty json effects nothing. eps are not changed from default.
        var mainEp = Autoya.EndPoint_GetEndPoint <main>();

        Assert.True(mainEp.key0 == "default_val0", "not match. mainEp.key0:" + mainEp.key0);
        Assert.True(mainEp.key1 == "default_val1", "not match. mainEp.key1:" + mainEp.key1);

        var subEp = Autoya.EndPoint_GetEndPoint <sub>();

        Assert.True(subEp.key0 == null, "not match. subEp.key0:" + subEp.key0);
    }