public async void NotExistAuthorByNameTest() { AuthorRepository authorRepository = new AuthorRepository(_dataContext); var result = await authorRepository.ExistAuthorByName("Sem nome"); Assert.False(result); }
public async void ExistAuthorByNameTest() { AuthorRepository authorRepository = new AuthorRepository(_dataContext); var result = await authorRepository.ExistAuthorByName("Diego Fernandes"); Assert.True(result); }
public async void DeleteAuthorTest() { AuthorRepository authorRepository = new AuthorRepository(_dataContext); var author = await authorRepository.GetAuthorByNameAsync("Teste Atualizado"); authorRepository.Delete(author); await authorRepository.SaveChangesAsync(); var result = await authorRepository.ExistAuthorByName(author.Name); Assert.False(result); }
public async void UpdateAuthorTest() { AuthorRepository authorRepository = new AuthorRepository(_dataContext); var author = await authorRepository.GetAuthorByNameAsync("Teste"); author.Name = "Teste Atualizado"; authorRepository.Update(author); await authorRepository.SaveChangesAsync(); var authorUpdated = await authorRepository.ExistAuthorByName("Teste Atualizado"); Assert.True(authorUpdated); }
public async void CreateAuthorTest() { AuthorRepository authorRepository = new AuthorRepository(_dataContext); Author author = new Author() { AuthorType = AuthorType.Commentary, AvatarUrl = "", Bio = "Desconhecida", Name = "Teste", UserId = 8 }; authorRepository.Add(author); await authorRepository.SaveChangesAsync(); var result = await authorRepository.ExistAuthorByName(author.Name); Assert.True(result); }