public void Edit_ReturnsFalseOnExcepiton() { // Arrange var articlesService = new ArticlesService(null); // Act var result = articlesService.Edit(null); //Assert Assert.False(result); }
public void Edit_ReturnsFalseIfNotFound() { // Arrange var context = this.ServiceProvider.GetRequiredService <WmipDbContext>(); var article = new Article { Id = 1, Title = "art1" }; context.Articles.Add(article); context.SaveChanges(); var articlesService = new ArticlesService(context); var editInfo = new EditPostDto() { Id = 2, Title = "aaaararar" }; // Act var result = articlesService.Edit(editInfo); //Assert Assert.False(result); }
public void Edit_ChangesProperties() { // Arrange var context = this.ServiceProvider.GetRequiredService <WmipDbContext>(); var article = new Article { Id = 1, Title = "art1" }; context.Articles.Add(article); context.SaveChanges(); var articlesService = new ArticlesService(context); var editInfo = new EditPostDto() { Id = 1, Title = "aaaararar" }; // Act var result = articlesService.Edit(editInfo); //Assert Assert.True(result); Assert.Equal(editInfo.Title, context.Articles.First().Title); }