public void CreatePost_CallRepository_Success() { // Arrange var repository = new TestSetup().SetupRepository(); var service = new TestSetup().SetupService(mockRepository: repository); // Act service.CreatePost(new Post()).Wait(); // Assert repository.Verify(i => i.CreatePost(It.IsNotNull <Post>())); }
public void CreatePost_Success(Post post) { // Arrange var repository = new TestSetup().SetupRepository(); // Act repository.CreatePost(post).Wait(); // Assert CollectionAssert.IsNotEmpty(repository.Storage); Assert.AreNotEqual(default(int), post.PostId); Assert.AreNotEqual(default(DateTime), post.CreationDate); }