Beispiel #1
0
            public void ReturnsUnsuccessfulResultIfInstanceHasNoImage()
            {
                var teamID = new Snowflake(0);

                var mockedTeam = new Mock <ITeam>();

                mockedTeam.SetupGet(g => g.Icon).Returns((IImageHash?)null);
                mockedTeam.SetupGet(g => g.ID).Returns(teamID);

                var team = mockedTeam.Object;

                var getActual = CDN.GetTeamIconUrl(team, CDNImageFormat.PNG);

                Assert.False(getActual.IsSuccess);
                Assert.IsType <ImageNotFoundError>(getActual.Unwrap());
            }
Beispiel #2
0
            /// <inheritdoc />
            protected override IEnumerable <Result <Uri> > GetImageUris
            (
                Optional <CDNImageFormat> imageFormat = default,
                Optional <ushort> imageSize           = default
            )
            {
                var teamID    = new Snowflake(0);
                var imageHash = new ImageHash("1");

                var mockedTeam = new Mock <ITeam>();

                mockedTeam.SetupGet(g => g.Icon).Returns(imageHash);
                mockedTeam.SetupGet(g => g.ID).Returns(teamID);

                var team = mockedTeam.Object;

                yield return(CDN.GetTeamIconUrl(team, imageFormat, imageSize));

                yield return(CDN.GetTeamIconUrl(teamID, imageHash, imageFormat, imageSize));
            }