public void Add_CuandoSeEjecuta_AgregaUnPostADB() { context.Database.EnsureDeleted(); Post fakePost = new Post { Title = "Post A", Body = "Cuerpo del post 1", Autor = "Luis" }; var SUT = new InMemoryPostDb(context); var newPost = SUT.Add(fakePost); context.Posts.Find(newPost.Id).Should().BeEquivalentTo(newPost); }
public void Update_TestOFTheInMemoryPostDB() { context.Database.EnsureDeleted(); Post fakePost = new Post { Title = "Post D", Body = "Cuerpo del post 4", Autor = "Luis" }; var SUT = new InMemoryPostDb(context); //var newPost = context.Posts.Add(fakePost).Entity; var newPost = SUT.Add(fakePost); fakePost.Body = "Actualizado"; SUT.Update(fakePost); var UpdatedPost = SUT.GetById(newPost.Id); //context.Posts.Find(newPost.Body).Should().BeEquivalentTo(UpdatedPost.Body); UpdatedPost.Body.Should().Be(fakePost.Body); }