Пример #1
0
        public void Should_DeserializeScoreboardJson_ForValidInput()
        {
            //arrange
            string json = JsonScoreboardResponseConstants.VALID_SCOREBOARD_JSON;
            IJsonSerializationProvider jsonSerializationProvider = new JsonSerializationProvider();

            //act
            LeagueScoreboard deserializedScoreboard = jsonSerializationProvider.DeserializeJson <LeagueScoreboard>(json);

            //assert
            deserializedScoreboard.Should().BeEquivalentTo(CSharpScoreboardTestCaseConstants.SCOREBOARD_OUTPUT_OBJECT);
        }
Пример #2
0
        public async Task Should_GetScoreboardAsync_ForValidInput()
        {
            //arrange
            int leagueId = 526113;
            int year     = 2018;
            EspnFantasyFootballClient espnFantasyFootballClient = new EspnFantasyFootballClient();

            //act
            LeagueScoreboard leagueScoreboard = await espnFantasyFootballClient.GetScoreboardAsync(leagueId, year);

            //assert
            leagueScoreboard.Should().NotBeNull();
        }
        public async Task Should_GetScoreboardAsync_ForValidInput()
        {
            //arrange
            int                       leagueId                 = 555555;
            int                       year                     = 2018;
            IHttpProvider             httpProvider             = A.Fake <IHttpProvider>();
            IUrlConfigurationProvider urlConfigurationProvider = A.Fake <IUrlConfigurationProvider>();
            IFantasyFootballService   fantasyFootballService   = new EspnApiFantasyFootballService(httpProvider, urlConfigurationProvider);

            //act
            LeagueScoreboard leagueScoreboard = await fantasyFootballService.GetScoreboardAsync(leagueId, year);

            //assert
            A.CallTo(() => urlConfigurationProvider.GetScoreboardEndpoint(leagueId, year)).MustHaveHappened();
            A.CallTo(() => httpProvider.GetAsync <LeagueScoreboard>(null)).WithAnyArguments().MustHaveHappened();
        }