public void ReturnsUnsuccessfulResultIfInstanceHasNoImage() { var applicationID = new Snowflake(0); var mockedApplication = new Mock <IApplication>(); mockedApplication.SetupGet(g => g.CoverImage).Returns(default(Optional <IImageHash>)); mockedApplication.SetupGet(g => g.ID).Returns(applicationID); var application = mockedApplication.Object; var getActual = CDN.GetApplicationCoverUrl(application, CDNImageFormat.PNG); Assert.False(getActual.IsSuccess); Assert.IsType <ImageNotFoundError>(getActual.Unwrap()); }
/// <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.CoverImage).Returns(imageHash); mockedApplication.SetupGet(g => g.ID).Returns(applicationID); var application = mockedApplication.Object; yield return(CDN.GetApplicationCoverUrl(application, imageFormat, imageSize)); yield return(CDN.GetApplicationCoverUrl(applicationID, imageHash, imageFormat, imageSize)); }