public async Task Run_Func_ExecutesTwice()
        {
            // arrange
            var next1    = new NextFunc();
            var next2    = new NextFunc();
            int executed = 0;

            Task Middleware(DispatchMiddlewareContext context, Func <Task> next)
            {
                executed++;
                return(next());
            }

            var descriptor = new TaskMiddlewareDescriptor(Middleware);
            var context    = CreateContext();

            // act
            await TaskMiddlewareRunner.RunAsync(descriptor, context, next1.InvokeAsync);

            await TaskMiddlewareRunner.RunAsync(descriptor, context, next2.InvokeAsync);

            // assert
            executed.Should().Be(2);
            next1.ExecutionCount.Should().Be(1);
            next2.ExecutionCount.Should().Be(1);
        }
 public void GetRanking(string game, NextFunc next)
 {
     if (tmp != null)
     {
         StopCoroutine(tmp);
     }
     tmp = StartCoroutine(GetToPHP(game, next));
 }
        public async Task Run_Type_Executes(bool addMiddleware)
        {
            // arrange
            var next       = new NextFunc();
            var descriptor = TaskMiddlewareDescriptor.Create <TestMiddleware>();

            IServiceProvider serviceProvider = CreateServiceProvider(addMiddleware);
            var context = CreateContext(serviceProvider);

            // act
            await TaskMiddlewareRunner.RunAsync(descriptor, context, next.InvokeAsync);

            // assert
            var tracker = serviceProvider.GetRequiredService <ExecutionTracker>();

            tracker.ExecutionCount.Should().Be(1);
            next.ExecutionCount.Should().Be(1);
        }
Ejemplo n.º 4
0
    IEnumerator UpdateUserData2(NextFunc nextF = null)
    {
        Debug.Log("UpdateUserData2");
        Debug.Log("ValueDeliverScript.scoreHigh :: " + ValueDeliverScript.scoreHigh);
        Debug.Log("ValueDeliverScript.scorePlay :: " + ValueDeliverScript.scorePlay);

        //하이스코어 관련 업뎃은 한번만 따로 하니 여기서 수시로 없뎃을 할 이유가 없음//
        //yield return StartCoroutine(UpdateScore());
        //하이스코어 관련 업뎃은 한번만 따로 하니 여기서 수시로 없뎃을 할 이유가 없음//

        yield return(StartCoroutine(UpdateGameinfo()));

        yield return(StartCoroutine(UpdateIteminfo()));

        yield return(StartCoroutine(UpdateFlightInfo()));

        if (nextF != null)
        {
            nextF();
        }
    }
    IEnumerator GetToPHP(string game, NextFunc next)
    {
        resultList = new List <Record>();

        WWW www = new WWW("http://35.221.70.194/gca/getrank.php?game_num=" + game);

        yield return(www);

        if (www.text.Length == 0)
        {
            yield break;
        }
        string[] result = www.text.Split('%');
        int      amount = int.Parse(result[0]);

        for (int i = 0; i < amount; ++i)
        {
            string[] row = result[i + 1].Split(' ');
            resultList.Add(new Record(row[0], int.Parse(row[1]), row[2].Substring(2, 10)));
        }
        next(resultList);
    }
Ejemplo n.º 6
0
 public void UpdateUserData1(NextFunc nextF = null)
 {
     StartCoroutine(UpdateUserData2(nextF));
 }