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

                var mockedGuild = new Mock <IGuild>();

                mockedGuild.SetupGet(g => g.DiscoverySplash).Returns((IImageHash?)null);
                mockedGuild.SetupGet(g => g.ID).Returns(guildID);

                var guild = mockedGuild.Object;

                var getActual = CDN.GetGuildDiscoverySplashUrl(guild, 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 guildID   = new Snowflake(0);
                var imageHash = new ImageHash("1");

                var mockedGuild = new Mock <IGuild>();

                mockedGuild.SetupGet(g => g.DiscoverySplash).Returns(imageHash);
                mockedGuild.SetupGet(g => g.ID).Returns(guildID);

                var guild = mockedGuild.Object;

                yield return(CDN.GetGuildDiscoverySplashUrl(guild, imageFormat, imageSize));

                yield return(CDN.GetGuildDiscoverySplashUrl(guildID, imageHash, imageFormat, imageSize));
            }