protected override async Task OnInitializedAsync()
        {
            var response = await AwsJsInterop.GraphQlAsync <CompetitionList>(Queries.LIST_COMPETITIONS);

            CompetitionList = response.ListCompetitions.Items;

            LiveScoreService.Start(CompetitionList);
        }
예제 #2
0
        public async Task GraphQlAsync_should_call_corresponding_js()
        {
            var jsRuntimeMock = new Mock <IJSRuntime>();
            var awsHelperMock = new Mock <IAwsHelper>();

            jsRuntimeMock.Setup(m => m.InvokeAsync <GraphQlData <string> >(It.Is <string>(s => s == "amplifyWrapper.graphql.operation"),
                                                                           It.IsAny <string>(),
                                                                           It.IsAny <string>()))
            .ReturnsAsync(new GraphQlData <string>
            {
                Data = "test"
            })
            .Verifiable();

            var sut = new AwsJsInterop(jsRuntimeMock.Object, awsHelperMock.Object);

            var response = await sut.GraphQlAsync <string>("test", "test");

            jsRuntimeMock.Verify(m => m.InvokeAsync <object>(It.Is <string>(s => s == "amplifyWrapper.graphql.operation"),
                                                             It.IsAny <string>(),
                                                             It.IsAny <string>()), Times.Exactly(1));

            Assert.Equal("test", response);
        }