public void Can_Not_Add_Null_Post() { var repository = new Mock<IPostRepository>(); var component = new PostComponent(repository.Object); Post post = null; component.Add(post); }
public void OnValueChangeNotified(PostComponent newPost) { if (selectedPieceAsset == this) { gameObject.transform.position = newPost.dropPosition.position; } }
private PostComponentViewModel CreatePostComponent(PostComponent component) { return(new PostComponentViewModel() { Data = component.Data, PostId = component.PostId }); }
public void Can_Not_Add_Post_Without_Body() { // Arrange ... var repository = new Mock<IPostRepository>(); var component = new PostComponent(repository.Object); Post post = new Post(); post.Title = "This is a very simple title for my first post"; post.Blog = new Blog(); post.Author = new User(); // Act ... component.Add(post); // Assert .. verify repository.Verify(c => c.Add(post), Times.Never()); }
public List <Post> GetSortedListOfPosts(PostComponent sortType) { var posts = _postRepo.GetAllPosts(); switch (sortType) { case PostComponent.author: return(posts.OrderBy(x => x.Author.Name).ToList()); case PostComponent.title: return(posts.OrderBy(x => x.Title).ToList()); case PostComponent.timestamp: return(posts.OrderBy(x => x.Timestamp).ToList()); default: return(posts); } }
public void TestGetSortedListOfPosts(PostComponent postComp) { var mockPostRepo = new MockPostRepo(); var postDataAccess = new PostDataAccess(mockPostRepo, new MockPostValidator(), new MockAuthorRepo(), new MockAuthorValidator()); var aPost = new Post("AAA", new Author("AAA", 0), "AAA", Convert.ToDateTime("1111-01-01T11:11:11.1111111Z"), Guid.Parse("11111111-1111-1111-1111-111111111111")); var bPost = new Post("BBB", new Author("BBB", 1), "BBB", Convert.ToDateTime("1112-02-02T12:22:22.2222222Z"), Guid.Parse("22222222-2222-2222-2222-222222222222")); var cPost = new Post("CCC", new Author("CCC", 2), "CCC", Convert.ToDateTime("1113-03-03T13:33:33.3333333Z"), Guid.Parse("33333333-3333-3333-3333-333333333333")); var listOfPosts = new List <Post>() { cPost, aPost, bPost }; mockPostRepo.StubGetAllPosts(listOfPosts); var returnedListOfPosts = postDataAccess.GetSortedListOfPosts(postComp); mockPostRepo.AssertGetAllPostsCalled(); Assert.Equal(listOfPosts.Count, returnedListOfPosts.Count); AssertPostsEqual(aPost, returnedListOfPosts[0]); AssertPostsEqual(bPost, returnedListOfPosts[1]); AssertPostsEqual(cPost, returnedListOfPosts[2]); }
public void OnValueChangeNotified(PostComponent newPost) { gameObject.transform.position = newPost.markerPosition.position; }
public List <Post> GetSortedListOfPosts(PostComponent sortType) { _calledGetSortedListOfPosts = true; return(_stubedGetSortedListOfPosts); }
public void Can_Not_Get_By_Id_If_Id_Is_Less_Than_1() { // Arrange ... var repository = new Mock<IPostRepository>(); var component = new PostComponent(repository.Object); const long id = 0; // Act ... component.GetById(id); // Assert .. verify repository.Verify(c => c.Get(id), Times.Never()); }