public async Task GetMemeAsync_With_Id_a0Q558q_Should_Return_MemeAsync() { // Arrange MemeDto expectedMemeDto = new MemeDto { Id = "a0Q558q", ImageUrl = "https://images-cdn.9gag.com/photo/a0Q558q_700b.jpg", VideoUrl = "http://img-9gag-fun.9cache.com/photo/a0Q558q_460sv.mp4", PageUrl = "http://9gag.com/gag/a0Q558q", Title = "Old but Gold" }; Meme entity = DtoToEntityConverter.Convert <Meme, MemeDto>(expectedMemeDto); Assert.IsTrue(await MemeRepository.CreateAsync(entity)); // Act MemeDto actualMemeDto = await MemeService.GetMemeAsync("a0Q558q"); // Assert Assert.AreEqual(expectedMemeDto, actualMemeDto); }
public async Task GetMeme() { var meme = await _memes.GetMemeAsync(); if (meme is null) { await ReplyAsync( new BotMessageBuilder() .WithEmbedWithTitle("No memes left for today =(") .WithDisplayType(BotMessageStyle.Error) ); return; } await ReplyAsync( new BotMessageBuilder() .WithEmbedWithTitle(meme.Title) .WithEmbedWithUrl(meme.SourceUrl) .WithEmbedWithImageUrl(meme.ContentUrl) .WithDisplayType(BotMessageStyle.Success) ); }
public async Task GetMemeAsync_With_Id_a0Q558q_With_Empty_Repository_Should_Throw_EntityNotFoundException() { // Arrange // in TestInitialize // Act & Assert await Assert.ThrowsExceptionAsync <EntityNotFoundException>(async() => await MemeService.GetMemeAsync("a0Q558q")); }