public void WhenNoActionsShouldReturnEmptyList() { //Arrange var handler = new GetPosts(_repository); //Act var posts = handler.Execute(); //Assert Assert.NotNull(posts); Assert.Empty(posts); }
public void ShouldReturnActionsWhenExistingInDatabase() { //Arrange var handler = new GetPosts(_repository); var currentUserName = IdentityProviderFactory.CreateCLPIdentity().GetCurrentIdentity(); var name = currentUserName.Contains("\\") ? currentUserName.Split('\\')[1] : currentUserName; var newposts = PostTestHelper.GetPosts(); foreach (var post in newposts) { _unitOfWork.AddOrUpdate(post); } var posts = handler.Execute(); //Assert Assert.NotNull(posts); Assert.NotEmpty(posts); Assert.Equal(3, posts.Count()); }