コード例 #1
0
            public void ReturnsUnsuccessfulResultIfInstanceHasNoImage()
            {
                var applicationID = new Snowflake(0);

                var mockedApplication = new Mock <IApplication>();

                mockedApplication.SetupGet(g => g.Icon).Returns((IImageHash?)null);
                mockedApplication.SetupGet(g => g.ID).Returns(applicationID);

                var application = mockedApplication.Object;

                var getActual = CDN.GetApplicationIconUrl(application, CDNImageFormat.PNG);

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

                var mockedApplication = new Mock <IApplication>();

                mockedApplication.SetupGet(g => g.Icon).Returns(imageHash);
                mockedApplication.SetupGet(g => g.ID).Returns(applicationID);

                var application = mockedApplication.Object;

                yield return(CDN.GetApplicationIconUrl(application, imageFormat, imageSize));

                yield return(CDN.GetApplicationIconUrl(applicationID, imageHash, imageFormat, imageSize));
            }