Exemplo n.º 1
0
        public async Task InitializeAsync()
        {
            ApplicationDbFactory = new ApplicationDbFactory("InMemoryDatabase");
            await ApplicationDbFactory.Create().Database.EnsureDeletedAsync();

            await ApplicationDbFactory.Create().Database.EnsureCreatedAsync();

            ApplicationDbFactory.Create().ResetValueGenerators();
            MemeRepository = new MemeRepository(ApplicationDbFactory.Create(), MemeValidator);
            MemeService    = new MemeService(MemeFetcherService, MemeRepository);
        }
Exemplo n.º 2
0
        public async Task GetRandomMemeAsync_Should_Return_2_Unique_Memes()
        {
            // Arrange
            // in TestInitialize

            // Act
            MemeDto memeDto1 = await MemeService.GetRandomMemeAsync();

            MemeDto memeDto2 = await MemeService.GetRandomMemeAsync();

            // Assert
            Assert.AreNotEqual(memeDto1, memeDto2);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 public MemeModule(MemeService memes)
 {
     _memes = memes;
 }
Exemplo n.º 5
0
 public GruCommand(MemeService meme)
 {
     this._meme = meme;
 }
Exemplo n.º 6
0
        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"));
        }
Exemplo n.º 7
0
 public DeathNoteCommand(MemeService meme)
 {
     this._meme = meme;
 }
Exemplo n.º 8
0
 public CustomCommandMessageHandler(MemeService memeService)
 {
     _memeService = memeService;
     _memeService.OnReloadCommands += OnReloadCommandNames;
     OnReloadCommandNames();
 }
Exemplo n.º 9
0
 public HelpModule(MemeService memeService, CommandService commandService)
 {
     _memeService    = memeService;
     _commandService = commandService;
 }
Exemplo n.º 10
0
 public PrisonerCommand(MemeService meme)
 {
     this._meme = meme;
 }
Exemplo n.º 11
0
 public MemeModule(MemeService memeService)
 {
     _memeService = memeService;
 }
Exemplo n.º 12
0
 public NutCommand(MemeService meme)
 {
     this._meme = meme;
 }
Exemplo n.º 13
0
 public MemesController(MemeService memeService, UserService userService, TagService tagService)
 {
     _memeService = memeService;
     _userService = userService;
     _tagService  = tagService;
 }
Exemplo n.º 14
0
 public CreateCardCommand(MemeService meme)
 {
     this._meme = meme;
 }
Exemplo n.º 15
0
 public TheSearchCommand(MemeService meme)
 {
     this._meme = meme;
 }